From 9f79759c5b4c1659a20700967d4fe90dd778975f Mon Sep 17 00:00:00 2001 From: Vincent Quatrevieux Date: Tue, 9 Jul 2024 18:14:35 +0200 Subject: [PATCH] chore(fight): Add Buff interfaces to seprate AI and fight types --- .../fight/ai/proxy/ProxyActiveFighter.java | 3 +- .../fight/ai/proxy/ProxyPassiveFighter.java | 3 +- .../game/fight/ai/simulation/Simulator.java | 2 +- .../effect/GivePercentLifeSimulator.java | 2 +- .../ai/simulation/effect/HealSimulator.java | 2 +- .../effect/RemovePointsSimulator.java | 2 +- .../fight/castable/effect/EffectValue.java | 24 +-- .../fight/castable/effect/EffectsHandler.java | 8 +- .../game/fight/castable/effect/buff/Buff.java | 114 ++----------- .../fight/castable/effect/buff/BuffHook.java | 64 +++---- .../fight/castable/effect/buff/BuffList.java | 57 +++---- .../castable/effect/buff/BuffListHooks.java | 123 ++++++++++++++ .../fight/castable/effect/buff/Buffs.java | 106 +----------- .../fight/castable/effect/buff/FightBuff.java | 131 +++++++++++++++ .../effect/handler/EffectHandler.java | 4 +- .../handler/armor/AlterResistanceHandler.java | 6 +- .../armor/HealOrMultiplyDamageHandler.java | 10 +- .../handler/armor/ReduceDamageHandler.java | 8 +- .../handler/armor/ReflectDamageHandler.java | 6 +- .../handler/armor/SpellReturnHandler.java | 6 +- .../AbstractAlterCharacteristicHandler.java | 14 +- .../AddActionPointsHandler.java | 4 +- .../AddCharacteristicOnDamageHandler.java | 13 +- .../AddMovementPointsHandler.java | 4 +- ...ddNotDispellableCharacteristicHandler.java | 3 +- .../AlterCharacteristicHook.java | 8 +- .../characteristic/AlterVitalityHook.java | 4 +- .../BoostCasterSightHandler.java | 8 +- .../DecreaseCasterSightHandler.java | 8 +- .../RemoveActionPointsHandler.java | 4 +- .../RemoveMovementPointsHandler.java | 4 +- .../StealCharacteristicHandler.java | 6 +- .../point/AbstractPointLostApplier.java | 4 +- .../point/AbstractStealPointHandler.java | 4 +- .../characteristic/point/AlterPointHook.java | 4 +- .../effect/handler/damage/DamageApplier.java | 42 ++--- .../effect/handler/damage/DamageHandler.java | 8 +- .../damage/DamageOnActionPointUseHandler.java | 10 +- .../handler/damage/FixedDamageHandler.java | 6 +- .../damage/PercentLifeDamageHandler.java | 15 +- .../handler/damage/StealLifeHandler.java | 6 +- .../effect/handler/heal/FixedHealHandler.java | 6 +- .../effect/handler/heal/HealHandler.java | 6 +- .../handler/heal/HealOnAttackHandler.java | 6 +- .../handler/heal/HealOnDamageHandler.java | 8 +- .../handler/misc/AddDiscernmentHandler.java | 8 +- .../handler/misc/AddErosionHandler.java | 8 +- .../misc/ApplySpellOnStartTurnHandler.java | 8 +- .../handler/misc/ChangeAppearanceHandler.java | 12 +- .../effect/handler/misc/DispelHandler.java | 8 +- .../handler/misc/InvisibilityHandler.java | 18 +- .../effect/handler/misc/SkipTurnHandler.java | 10 +- .../handler/modifier/BoostSpellHandler.java | 12 +- .../modifier/IncreaseWeaponSkillHandler.java | 10 +- .../MaximizeTargetEffectsHandler.java | 6 +- .../MinimizeCastedEffectsHandler.java | 6 +- .../modifier/MultiplyDamageHandler.java | 6 +- .../AvoidDamageByMovingBackHandler.java | 6 +- .../SwitchPositionOnAttackHandler.java | 8 +- .../hook/AbstractEffectHookHandler.java | 4 +- .../effect/hook/ApplyOnActionPointLost.java | 4 +- .../effect/hook/ApplyOnElementDamage.java | 4 +- .../castable/effect/hook/ApplyOnHeal.java | 4 +- .../effect/hook/EffectHookHandler.java | 4 +- .../effect/hook/HookedSpellEffect.java | 4 +- .../game/fight/fighter/FighterData.java | 3 +- .../game/fight/fighter/FighterLife.java | 6 +- .../fight/fighter/DispelDeadFighterBuff.java | 4 +- .../spectator/SendFightStateToSpectator.java | 8 +- .../network/game/out/fight/AddBuff.java | 6 +- .../game/out/fight/action/ActionEffect.java | 4 +- .../fight/ai/simulation/SimulatorTest.java | 7 +- .../simulation/effect/ArmorSimulatorTest.java | 12 +- .../effect/DamageSimulatorTest.java | 10 +- .../PercentLifeDamageSimulatorTest.java | 7 +- .../PercentLifeLostDamageSimulatorTest.java | 7 +- .../effect/ReflectDamageSimulatorTest.java | 6 +- .../effect/SpellReturnSimulatorTest.java | 10 +- .../effect/StealLifeSimulatorTest.java | 4 +- .../castable/effect/EffectValueTest.java | 26 +-- .../castable/effect/EffectsHandlerTest.java | 17 +- .../fight/castable/effect/FunctionalTest.java | 36 ++-- .../castable/effect/buff/BuffListTest.java | 158 +++++++++--------- .../armor/AlterResistanceHandlerTest.java | 22 +-- .../HealOrMultiplyDamageHandlerTest.java | 14 +- .../armor/ReduceDamageHandlerTest.java | 14 +- .../armor/ReflectDamageHandlerTest.java | 12 +- .../handler/armor/SpellReturnHandlerTest.java | 18 +- .../AddActionPointsHandlerTest.java | 18 +- .../AddCharacteristicHandlerTest.java | 29 ++-- .../AddCharacteristicOnDamageHandlerTest.java | 20 +-- .../AddMovementPointsHandlerTest.java | 18 +- ...tDispellableCharacteristicHandlerTest.java | 26 +-- .../AddVitalityHandlerTest.java | 26 +-- .../AddVitalityNotDispellableHandlerTest.java | 26 +-- .../AlterCharacteristicHookTest.java | 6 +- .../characteristic/AlterVitalityHookTest.java | 6 +- .../BoostCasterSightHandlerTest.java | 14 +- .../DecreaseCasterSightHandlerTest.java | 14 +- .../RemoveActionPointsHandlerTest.java | 18 +- .../RemoveCharacteristicHandlerTest.java | 18 +- .../RemoveMovementPointsHandlerTest.java | 18 +- .../RemoveVitalityHandlerTest.java | 26 +-- .../StealCharacteristicHandlerTest.java | 20 +-- .../StealVitalityHandlerTest.java | 24 +-- .../point/ActionPointLostApplierTest.java | 8 +- .../point/ActionPointLostHandlerTest.java | 22 +-- .../point/AlterPointHookTest.java | 10 +- .../point/MovementPointLostApplierTest.java | 8 +- .../point/MovementPointLostHandlerTest.java | 22 +-- .../point/StealActionPointHandlerTest.java | 26 +-- .../point/StealMovementPointHandlerTest.java | 26 +-- .../handler/damage/DamageApplierTest.java | 116 ++++++------- .../handler/damage/DamageHandlerTest.java | 16 +- .../DamageOnActionPointUseHandlerTest.java | 4 +- .../damage/FixedCasterDamageHandlerTest.java | 4 +- .../damage/FixedDamageHandlerTest.java | 10 +- .../damage/FixedStealLifeHandlerTest.java | 4 +- .../IndirectPercentLifeDamageHandlerTest.java | 4 +- .../damage/PercentLifeDamageHandlerTest.java | 16 +- .../handler/damage/StealLifeHandlerTest.java | 8 +- .../handler/heal/FixedHealHandlerTest.java | 14 +- .../heal/GivePercentLifeHandlerTest.java | 4 +- .../effect/handler/heal/HealHandlerTest.java | 14 +- .../handler/heal/HealOnAttackHandlerTest.java | 8 +- .../handler/heal/HealOnDamageHandlerTest.java | 4 +- .../misc/AddDiscernmentHandlerTest.java | 18 +- .../handler/misc/AddErosionHandlerTest.java | 16 +- .../ApplySpellOnStartTurnHandlerTest.java | 8 +- .../misc/ChangeAppearanceHandlerTest.java | 10 +- .../handler/misc/DispelHandlerTest.java | 37 ++-- .../handler/misc/InvisibilityHandlerTest.java | 10 +- .../handler/misc/SkipTurnHandlerTest.java | 8 +- .../modifier/BoostSpellHandlerTest.java | 6 +- .../IncreaseWeaponSkillHandlerTest.java | 6 +- .../MaximizeTargetEffectsHandlerTest.java | 6 +- .../MinimizeCastedEffectsHandlerTest.java | 6 +- .../modifier/MultiplyDamageHandlerTest.java | 6 +- .../AvoidDamageByMovingBackHandlerTest.java | 4 +- .../SwitchPositionOnAttackHandlerTest.java | 6 +- .../hook/ApplyOnActionPointLostTest.java | 22 ++- .../effect/hook/ApplyOnElementDamageTest.java | 13 +- .../castable/effect/hook/ApplyOnHealTest.java | 10 +- .../fight/fighter/BaseFighterLifeTest.java | 20 +-- .../MonsterFighterCharacteristicsTest.java | 6 - .../game/fight/turn/FightTurnTest.java | 10 +- .../fighter/DispelDeadFighterBuffTest.java | 14 +- .../fight/fighter/RefreshBuffsTest.java | 4 +- .../SendFightStateToSpectatorTest.java | 6 +- .../network/game/out/fight/AddBuffTest.java | 8 +- .../out/fight/action/ActionEffectTest.java | 4 +- 151 files changed, 1222 insertions(+), 1164 deletions(-) create mode 100644 src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListHooks.java create mode 100644 src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/FightBuff.java diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyActiveFighter.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyActiveFighter.java index c2a855f1b..3df36d29a 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyActiveFighter.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyActiveFighter.java @@ -20,6 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.ai.proxy; import fr.arakne.utils.maps.constant.Direction; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs; import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterCharacteristics; @@ -102,7 +103,7 @@ public Life life() { } @Override - public Buffs buffs() { + public Buffs buffs() { return fighter.buffs(); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyPassiveFighter.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyPassiveFighter.java index a0860202c..0855fc0c9 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyPassiveFighter.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/proxy/ProxyPassiveFighter.java @@ -21,6 +21,7 @@ import fr.arakne.utils.maps.constant.Direction; import fr.quatrevieux.araknemu.game.fight.ai.AI; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs; import fr.quatrevieux.araknemu.game.fight.fighter.FighterCharacteristics; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -77,7 +78,7 @@ public Life life() { } @Override - public Buffs buffs() { + public Buffs buffs() { return fighter.buffs(); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/Simulator.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/Simulator.java index 0ffc5d1a3..fb94cf1de 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/Simulator.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/Simulator.java @@ -152,7 +152,7 @@ public SpellScore score(Spell spell, Characteristics characteristics) { * * @return The modified damage * - * @see BuffEffectSimulator#onReduceableDamage(CastSimulation simulation, Buff, FighterData, Damage) The called buff method + * @see BuffEffectSimulator#onReduceableDamage(CastSimulation, Buff, FighterData, Damage) The called buff method */ public Damage applyReduceableDamageBuffs(CastSimulation simulation, FighterData target, Damage damage) { for (Buff buff : target.buffs()) { diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/GivePercentLifeSimulator.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/GivePercentLifeSimulator.java index 915fd0000..bf537d23f 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/GivePercentLifeSimulator.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/GivePercentLifeSimulator.java @@ -37,7 +37,7 @@ public final class GivePercentLifeSimulator implements EffectSimulator { @Override public void simulate(CastSimulation simulation, AI ai, CastScope.EffectScope effect) { final FighterData caster = ai.fighter(); - final int heal = EffectValue.create(effect.effect(), caster, caster).value() * caster.life().current() / 100; + final int heal = new EffectValue(effect.effect()).value() * caster.life().current() / 100; simulation.addDamage(Interval.of(heal), caster); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/HealSimulator.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/HealSimulator.java index cabf290a6..29413389c 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/HealSimulator.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/HealSimulator.java @@ -46,7 +46,7 @@ public void simulate(CastSimulation simulation, AI ai, CastScope.EffectScope * * @param effect The spell effect - * @param caster The spell caster on which {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onEffectValueCast(EffectValue)} will be called - * @param targets Targets used to configure the effect value using {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onEffectValueTarget(EffectValue)} + * @param caster The spell caster on which {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onEffectValueCast(EffectValue)} will be called + * @param targets Targets used to configure the effect value using {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onEffectValueTarget(EffectValue)} * @param action Action to perform on each target, with their related effect value */ - public static void forEachTargets(SpellEffect effect, FighterData caster, Iterable targets, BiConsumer action) { + public static void forEachTargets(SpellEffect effect, Fighter caster, Iterable targets, BiConsumer action) { final Context context = preRoll(effect, caster); for (F target : targets) { @@ -238,7 +238,7 @@ public static void forEachTargets(SpellEffect effect, Fi * * The "dice" will be rolled and configured for the caster, and a factory will be returned * to configure the effect value for each target. - * The final effect value is configured using {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onEffectValueTarget(EffectValue)}. + * The final effect value is configured using {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onEffectValueTarget(EffectValue)}. * * So {@link EffectValue#minimize()} and {@link EffectValue#maximize()} are effective, without change the effects value of others targets * @@ -258,9 +258,9 @@ public static void forEachTargets(SpellEffect effect, Fi * } * * @param effect The spell effect - * @param caster The spell caster on which {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onEffectValueCast(EffectValue)} will be called + * @param caster The spell caster on which {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onEffectValueCast(EffectValue)} will be called */ - public static Context preRoll(SpellEffect effect, FighterData caster) { + public static Context preRoll(SpellEffect effect, Fighter caster) { final EffectValue value = new EffectValue(effect); caster.buffs().onEffectValueCast(value); @@ -310,6 +310,6 @@ public interface Context { * * @return The new instance of effect value, configured for the target */ - public EffectValue forTarget(FighterData target); + public EffectValue forTarget(Fighter target); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandler.java index 02556b912..0e5ffbb29 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.hook.EffectHookHandler; import fr.quatrevieux.araknemu.game.fight.castable.validator.CastConstraintValidator; @@ -98,8 +98,8 @@ public void registerHook(int hookId, EffectHookHandler applier) { /** * Apply a cast to the fight * - * First, this method will call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook#onCast(Buff, FightCastScope)} to caster - * Then call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook#onCastTarget(Buff, FightCastScope)} to all targets + * First, this method will call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook#onCast(FightBuff, FightCastScope)} to caster + * Then call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook#onCastTarget(FightBuff, FightCastScope)} to all targets * * After that, all effects will be applied by calling : * - Checking if the effect has a hook with {@link EffectTarget#isHook()} @@ -145,7 +145,7 @@ public void apply(FightCastScope cast) { } /** - * Call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onCastTarget(FightCastScope)} + * Call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onCastTarget(FightCastScope)} * on each target. * * If a target is changed (by calling {@link CastScope#replaceTarget(FighterData, FighterData)}), diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buff.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buff.java index 985e4f0de..7d6c79f6e 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buff.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buff.java @@ -14,124 +14,34 @@ * You should have received a copy of the GNU Lesser General Public License * along with Araknemu. If not, see . * - * Copyright (c) 2017-2019 Vincent Quatrevieux + * Copyright (c) 2017-2024 Vincent Quatrevieux */ package fr.quatrevieux.araknemu.game.fight.castable.effect.buff; -import fr.quatrevieux.araknemu.game.fight.castable.Castable; -import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; +import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; -import org.checkerframework.checker.index.qual.GTENegativeOne; /** - * Persistent effect + * Base type for buff applied to a fighter * - * The duration will be taken from the effect. - * For overload the buff effect value (or duration), you must create a new effect instance + * This interface is used by both AI and fight system, + * and its intended to be overridden to use appropriate types (e.g. fighter type) */ -public final class Buff { - private final SpellEffect effect; - private final Castable action; - private final Fighter caster; - private final Fighter target; - private final BuffHook hook; - private final boolean canBeDispelled; - - private @GTENegativeOne int remainingTurns; - - public Buff(SpellEffect effect, Castable action, Fighter caster, Fighter target, BuffHook hook) { - this(effect, action, caster, target, hook, true); - } - - public Buff(SpellEffect effect, Castable action, Fighter caster, Fighter target, BuffHook hook, boolean canBeDispelled) { - this.effect = effect; - this.action = action; - this.caster = caster; - this.target = target; - this.hook = hook; - this.canBeDispelled = canBeDispelled; - - this.remainingTurns = effect.duration(); - } - +public interface Buff { /** * Get the buff effect + * For most cases, {@link SpellEffect#min()} is used as the buff value, and {@link SpellEffect#max()} set to 0 */ - public SpellEffect effect() { - return effect; - } - - /** - * Get the action which generates this buff - */ - public Castable action() { - return action; - } - - /** - * Get the buff caster - */ - public Fighter caster() { - return caster; - } - - /** - * Get the buff target - */ - public Fighter target() { - return target; - } - - /** - * Remaining turns for the buff effect - * - * When this value reached 0, the buff should be removed - * In case of infinite effect, the returned value is -1 - */ - public @GTENegativeOne int remainingTurns() { - return remainingTurns; - } - - /** - * Decrements the remaining turns - * - * You should call {@link Buff#valid()} for check if the buff is still valid or not - */ - public void decrementRemainingTurns() { - if (remainingTurns > 0) { - --remainingTurns; - } - } - - /** - * Increment remaining turns - * Use this method when a self-buff is added - */ - public void incrementRemainingTurns() { - if (remainingTurns != -1) { - ++remainingTurns; - } - } - - /** - * Get the related hook for the buff - */ - public BuffHook hook() { - return hook; - } + public SpellEffect effect(); /** - * Check if the buff is still valid + * Get the buff caster (i.e. the fighter who cast the spell that applied the buff) */ - public boolean valid() { - return remainingTurns != 0; - } + public FighterData caster(); /** - * Check if the buff can be removed + * Get the buff target (i.e. the fighter who is affected by the buff) */ - public boolean canBeDispelled() { - return canBeDispelled; - } + public FighterData target(); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffHook.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffHook.java index 90021f897..f73899955 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffHook.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffHook.java @@ -41,30 +41,30 @@ public interface BuffHook { * * @return False if the fighter cannot start the turn */ - public default boolean onStartTurn(Buff buff) { + public default boolean onStartTurn(FightBuff buff) { return true; } /** * Apply effect on turn ending */ - public default void onEndTurn(Buff buff, Turn turn) {} + public default void onEndTurn(FightBuff buff, Turn turn) {} /** * Start the buff */ - public default void onBuffStarted(Buff buff) {} + public default void onBuffStarted(FightBuff buff) {} /** * The buff is terminated (buff expired, debuff...) */ - public default void onBuffTerminated(Buff buff) {} + public default void onBuffTerminated(FightBuff buff) {} /** * The fighter has cast a spell or close combat attack - * This buff is called before apply effects and resolve targets using {@link BuffHook#onCastTarget(Buff, FightCastScope)} + * This buff is called before apply effects and resolve targets using {@link BuffHook#onCastTarget(FightBuff, FightCastScope)} */ - public default void onCast(Buff buff, FightCastScope cast) {} + public default void onCast(FightBuff buff, FightCastScope cast) {} /** * The fighter is a target of a cast @@ -118,27 +118,27 @@ public default void onCast(Buff buff, FightCastScope cast) {} * @see CastScope#removeTarget(FighterData) * @see CastScope#replaceTarget(FighterData, FighterData) */ - public default boolean onCastTarget(Buff buff, FightCastScope cast) { + public default boolean onCastTarget(FightBuff buff, FightCastScope cast) { return true; } /** * The fighter will take damages */ - public default void onDamage(Buff buff, Damage value) {} + public default void onDamage(FightBuff buff, Damage value) {} /** * The fighter will take damages */ - public default void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public default void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { onDamage(buff, value); } /** * Direct damage has been applied to the current fighter - * This hook is called after {@link BuffHook#onDirectDamage(Buff, Fighter, Damage)} + * This hook is called after {@link BuffHook#onDirectDamage(FightBuff, Fighter, Damage)} * - * Unlike {@link BuffHook#onLifeAltered(Buff, int)} this hook is only called by direct damage attack, so it ignores + * Unlike {@link BuffHook#onLifeAltered(FightBuff, int)} this hook is only called by direct damage attack, so it ignores * poison, push damage and some special effects. * * Note: this hook is not called if the attack has killed the fighter @@ -147,12 +147,12 @@ public default void onDirectDamage(Buff buff, Fighter caster, Damage value) { * @param caster Attack caster * @param damage Applied damage. Always positive. If an attack is inefficient, this hook will not be called. */ - public default void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) {} + public default void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) {} /** * The fighter will take damages indirectly (like poison) */ - public default void onIndirectDamage(Buff buff, Fighter caster, Damage value) { + public default void onIndirectDamage(FightBuff buff, Fighter caster, Damage value) { onDamage(buff, value); } @@ -163,14 +163,14 @@ public default void onIndirectDamage(Buff buff, Fighter caster, Damage value) { * @param poison The poison buff * @param value The damage to apply */ - public default void onBuffDamage(Buff buff, Buff poison, Damage value) { + public default void onBuffDamage(FightBuff buff, FightBuff poison, Damage value) { onIndirectDamage(buff, buff.caster(), value); } /** * The fighter life has been altered * - * Unlike {@link BuffHook#onDamage(Buff, Damage)}, the effects has already been applied + * Unlike {@link BuffHook#onDamage(FightBuff, Damage)}, the effects has already been applied * * @param buff The active buff * @param value Altered life value. Negative for a damage, positive for a heal @@ -178,16 +178,16 @@ public default void onBuffDamage(Buff buff, Buff poison, Damage value) { * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#damage(Fighter, int) * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#heal(Fighter, int) */ - public default void onLifeAltered(Buff buff, int value) {} + public default void onLifeAltered(FightBuff buff, int value) {} /** * The fighter has suffered a damage, so its life has been altered - * By default, this method will forward the call to {@link BuffHook#onLifeAltered(Buff, int)} + * By default, this method will forward the call to {@link BuffHook#onLifeAltered(FightBuff, int)} * * This buff is always called when damage is applied, even if the damage is completely absorbed, * or in case of direct or indirect damage. * - * Unlike {@link BuffHook#onDamage(Buff, Damage)}, the effects has already been applied + * Unlike {@link BuffHook#onDamage(FightBuff, Damage)}, the effects has already been applied * * Note: this hook is not called if the attack has killed the fighter * @@ -195,27 +195,27 @@ public default void onLifeAltered(Buff buff, int value) {} * @param value Altered life value. Can be 0 when the effect is completely absorbed * * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#damage(Fighter, int) - * @see #onDirectDamageApplied(Buff, Fighter, int) To hook only damage applied by direct attack + * @see #onDirectDamageApplied(FightBuff, Fighter, int) To hook only damage applied by direct attack */ - public default void onDamageApplied(Buff buff, @NonNegative int value) { + public default void onDamageApplied(FightBuff buff, @NonNegative int value) { onLifeAltered(buff, -value); } /** * Elemental damage has been applied to the current fighter * - * This hook is called after {@link BuffHook#onDamageApplied(Buff, int)}, but only in case + * This hook is called after {@link BuffHook#onDamageApplied(FightBuff, int)}, but only in case * of damage related to an element (e.i. fire, water, air, earth, neutral) * * @param buff The active buff * @param element The element of the damage * @param value The damage value. Can be 0 if the damage is completely absorbed */ - public default void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) {} + public default void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) {} /** * The fighter life has been healed - * By default, this method will forward the call to {@link BuffHook#onLifeAltered(Buff, int)} + * By default, this method will forward the call to {@link BuffHook#onLifeAltered(FightBuff, int)} * * This hook is called after heal is applied. * @@ -224,7 +224,7 @@ public default void onElementDamageApplied(Buff buff, Element element, @NonNegat * * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#heal(Fighter, int) */ - public default void onHealApplied(Buff buff, @NonNegative int value) { + public default void onHealApplied(FightBuff buff, @NonNegative int value) { onLifeAltered(buff, value); } @@ -237,39 +237,39 @@ public default void onHealApplied(Buff buff, @NonNegative int value) { * @param buff The active buff * @param damage The reflected damage */ - public default void onReflectedDamage(Buff buff, ReflectedDamage damage) {} + public default void onReflectedDamage(FightBuff buff, ReflectedDamage damage) {} /** * A damage will be applied on target * Use this hook to configure damage before apply it * - * Unlike {@link BuffHook#onDamage(Buff, Damage)} this hook is called on the caster instead of the target + * Unlike {@link BuffHook#onDamage(FightBuff, Damage)} this hook is called on the caster instead of the target * * @param buff The active buff * @param damage Damage to configure * @param target The effect target */ - public default void onCastDamage(Buff buff, Damage damage, Fighter target) {} + public default void onCastDamage(FightBuff buff, Damage damage, Fighter target) {} /** * A new effect value is generated by the current fighter * - * Note: {@link BuffHook#onEffectValueTarget(Buff, EffectValue)} is always called on the target after + * Note: {@link BuffHook#onEffectValueTarget(FightBuff, EffectValue)} is always called on the target after * * @param buff The active buff * @param value The new effect value which will be applied */ - public default void onEffectValueCast(Buff buff, EffectValue value) {} + public default void onEffectValueCast(FightBuff buff, EffectValue value) {} /** * An effect value will be applied on the current fighter * - * Note: {@link BuffHook#onEffectValueCast(Buff, EffectValue)} is always called on the caster before + * Note: {@link BuffHook#onEffectValueCast(FightBuff, EffectValue)} is always called on the caster before * * @param buff The active buff * @param value The effect value which will be applied */ - public default void onEffectValueTarget(Buff buff, EffectValue value) {} + public default void onEffectValueTarget(FightBuff buff, EffectValue value) {} /** * A characteristic of the fighter has been altered @@ -278,5 +278,5 @@ public default void onEffectValueTarget(Buff buff, EffectValue value) {} * @param characteristic The altered characteristic * @param value The characteristic modifier. Positive for add the characteristic, or negative to remove. */ - public default void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) {} + public default void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) {} } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffList.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffList.java index 1ae0e5609..40b9a1660 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffList.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffList.java @@ -26,6 +26,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.ReflectedDamage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; +import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.turn.Turn; import fr.quatrevieux.araknemu.network.game.out.fight.AddBuff; import fr.quatrevieux.araknemu.util.SafeLinkedList; @@ -40,28 +41,28 @@ /** * Handle buff list for a fighter */ -public final class BuffList implements Iterable, Buffs { +public final class BuffList implements Iterable, Buffs, BuffListHooks { private final Fighter fighter; - private final SafeLinkedList buffs = new SafeLinkedList<>(); + private final SafeLinkedList buffs = new SafeLinkedList<>(); public BuffList(Fighter fighter) { this.fighter = fighter; } @Override - public Iterator iterator() { + public Iterator iterator() { return buffs.iterator(); } /** * Get the Buff stream */ - public Stream stream() { + public Stream stream() { return StreamSupport.stream(spliterator(), false); } @Override - public void add(Buff buff) { + public void add(FightBuff buff) { final boolean isPlayingFighter = fighter.isPlaying(); buffs.add(buff); @@ -83,7 +84,7 @@ public void add(Buff buff) { public boolean onStartTurn() { boolean result = true; - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { result &= buff.hook().onStartTurn(buff); } @@ -92,21 +93,21 @@ public boolean onStartTurn() { @Override public void onEndTurn(Turn turn) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onEndTurn(buff, turn); } } @Override public void onCast(FightCastScope cast) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onCast(buff, cast); } } @Override public boolean onCastTarget(FightCastScope cast) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { if (!buff.hook().onCastTarget(buff, cast)) { return false; } @@ -117,84 +118,84 @@ public boolean onCastTarget(FightCastScope cast) { @Override public void onDirectDamage(Fighter caster, Damage value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onDirectDamage(buff, caster, value); } } @Override public void onIndirectDamage(Fighter caster, Damage value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onIndirectDamage(buff, caster, value); } } @Override - public void onBuffDamage(Buff poison, Damage value) { - for (Buff buff : buffs) { + public void onBuffDamage(FightBuff poison, Damage value) { + for (FightBuff buff : buffs) { buff.hook().onBuffDamage(buff, poison, value); } } @Override public void onDirectDamageApplied(Fighter caster, @Positive int value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onDirectDamageApplied(buff, caster, value); } } @Override public void onHealApplied(@NonNegative int value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onHealApplied(buff, value); } } @Override public void onDamageApplied(@NonNegative int value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onDamageApplied(buff, value); } } @Override public void onElementDamageApplied(Element element, @NonNegative int actualDamage) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onElementDamageApplied(buff, element, actualDamage); } } @Override public void onReflectedDamage(ReflectedDamage damage) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onReflectedDamage(buff, damage); } } @Override public void onCastDamage(Damage damage, Fighter target) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onCastDamage(buff, damage, target); } } @Override public void onEffectValueCast(EffectValue value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onEffectValueCast(buff, value); } } @Override public void onEffectValueTarget(EffectValue value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onEffectValueTarget(buff, value); } } @Override public void onCharacteristicAltered(Characteristic characteristic, int value) { - for (Buff buff : buffs) { + for (FightBuff buff : buffs) { buff.hook().onCharacteristicAltered(buff, characteristic, value); } } @@ -202,17 +203,17 @@ public void onCharacteristicAltered(Characteristic characteristic, int value) { @Override public void refresh() { // invalidate buffs before removing it in case of buffs are iterated by onBuffTerminated() hook - buffs.forEach(Buff::decrementRemainingTurns); + buffs.forEach(FightBuff::decrementRemainingTurns); removeIf(buff -> !buff.valid()); } @Override public boolean removeAll() { - return removeIf(Buff::canBeDispelled); + return removeIf(FightBuff::canBeDispelled); } @Override - public boolean removeByCaster(Fighter caster) { + public boolean removeByCaster(FighterData caster) { return removeIf(buff -> buff.caster().equals(caster)); } @@ -223,13 +224,13 @@ public boolean removeByCaster(Fighter caster) { * * @return true if there is a change (i.e. a buff is terminated) */ - private boolean removeIf(Predicate predicate) { - final Iterator iterator = buffs.iterator(); + private boolean removeIf(Predicate predicate) { + final Iterator iterator = buffs.iterator(); boolean hasChanged = false; while (iterator.hasNext()) { - final Buff buff = iterator.next(); + final FightBuff buff = iterator.next(); if (predicate.test(buff)) { iterator.remove(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListHooks.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListHooks.java new file mode 100644 index 000000000..093634025 --- /dev/null +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListHooks.java @@ -0,0 +1,123 @@ +/* + * This file is part of Araknemu. + * + * Araknemu is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Araknemu 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Araknemu. If not, see . + * + * Copyright (c) 2017-2024 Vincent Quatrevieux + */ + +package fr.quatrevieux.araknemu.game.fight.castable.effect.buff; + +import fr.quatrevieux.araknemu.data.constant.Characteristic; +import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; +import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; +import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; +import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; +import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.ReflectedDamage; +import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; +import fr.quatrevieux.araknemu.game.fight.turn.Turn; +import org.checkerframework.checker.index.qual.NonNegative; +import org.checkerframework.checker.index.qual.Positive; + +/** + * All hooks methods applied on fighter buff list + */ +public interface BuffListHooks { + /** + * @see BuffHook#onCast(FightBuff, FightCastScope) + */ + public void onCast(FightCastScope cast); + + /** + * Apply buffs when the fighter is a target of a cast + * + * If false is returned, the scope targets should be reloaded to call this hook on new targets, + * and following hooks will be ignored. + * + * @return true to continue, or false if the target has changed (or is removed) + * + * @see BuffHook#onCastTarget(FightBuff, FightCastScope) + */ + public boolean onCastTarget(FightCastScope cast); + + /** + * @see BuffHook#onDirectDamage(FightBuff, Fighter, Damage) + */ + public void onDirectDamage(Fighter caster, Damage value); + + /** + * @see BuffHook#onIndirectDamage(FightBuff, Fighter, Damage) + */ + public void onIndirectDamage(Fighter caster, Damage value); + + /** + * @see BuffHook#onBuffDamage(FightBuff, FightBuff, Damage) + */ + public void onBuffDamage(FightBuff poison, Damage value); + + /** + * @see BuffHook#onDirectDamageApplied(FightBuff, Fighter, int) + */ + public void onDirectDamageApplied(Fighter caster, @Positive int value); + + /** + * @see BuffHook#onElementDamageApplied(FightBuff, Element element, int) + */ + public void onElementDamageApplied(Element element, @NonNegative int actualDamage); + + /** + * @see BuffHook#onDamageApplied(FightBuff, int) + */ + public void onDamageApplied(@NonNegative int value); + + /** + * @see BuffHook#onHealApplied(FightBuff, int) + */ + public void onHealApplied(@NonNegative int value); + + /** + * @see BuffHook#onReflectedDamage(FightBuff, ReflectedDamage) + */ + public void onReflectedDamage(ReflectedDamage damage); + + /** + * @see BuffHook#onStartTurn(FightBuff) + */ + public boolean onStartTurn(); + + /** + * @see BuffHook#onEndTurn(FightBuff, Turn) + */ + public void onEndTurn(Turn turn); + + /** + * @see BuffHook#onCastDamage(FightBuff, Damage, Fighter) + */ + public void onCastDamage(Damage damage, Fighter target); + + /** + * @see BuffHook#onEffectValueCast(FightBuff, EffectValue) + */ + public void onEffectValueCast(EffectValue value); + + /** + * @see BuffHook#onEffectValueTarget(FightBuff, EffectValue) + */ + public void onEffectValueTarget(EffectValue value); + + /** + * @see BuffHook#onCharacteristicAltered(FightBuff, Characteristic, int) + */ + public void onCharacteristicAltered(Characteristic characteristic, int value); +} diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buffs.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buffs.java index de077a6f9..60353689a 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buffs.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/Buffs.java @@ -19,112 +19,16 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.buff; -import fr.quatrevieux.araknemu.data.constant.Characteristic; -import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; -import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.ReflectedDamage; -import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; -import fr.quatrevieux.araknemu.game.fight.turn.Turn; -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.index.qual.Positive; +import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; /** * Handle and store buff list for a fighter */ -public interface Buffs extends Iterable { +public interface Buffs extends Iterable { /** * Add and start a buff */ - public void add(Buff buff); - - /** - * @see BuffHook#onCast(Buff, FightCastScope) - */ - public void onCast(FightCastScope cast); - - /** - * Apply buffs when the fighter is a target of a cast - * - * If false is returned, the scope targets should be reloaded to call this hook on new targets, - * and following hooks will be ignored. - * - * @return true to continue, or false if the target has changed (or is removed) - * - * @see BuffHook#onCastTarget(Buff, FightCastScope) - */ - public boolean onCastTarget(FightCastScope cast); - - /** - * @see BuffHook#onDirectDamage(Buff, Fighter, Damage) - */ - public void onDirectDamage(Fighter caster, Damage value); - - /** - * @see BuffHook#onIndirectDamage(Buff, Fighter, Damage) - */ - public void onIndirectDamage(Fighter caster, Damage value); - - /** - * @see BuffHook#onBuffDamage(Buff, Buff, Damage) - */ - public void onBuffDamage(Buff poison, Damage value); - - /** - * @see BuffHook#onDirectDamageApplied(Buff, Fighter, int) - */ - public void onDirectDamageApplied(Fighter caster, @Positive int value); - - /** - * @see BuffHook#onElementDamageApplied(Buff, Element element, int) - */ - public void onElementDamageApplied(Element element, @NonNegative int actualDamage); - - /** - * @see BuffHook#onDamageApplied(Buff, int) - */ - public void onDamageApplied(@NonNegative int value); - - /** - * @see BuffHook#onHealApplied(Buff, int) - */ - public void onHealApplied(@NonNegative int value); - - /** - * @see BuffHook#onReflectedDamage(Buff, ReflectedDamage) - */ - public void onReflectedDamage(ReflectedDamage damage); - - /** - * @see BuffHook#onStartTurn(Buff) - */ - public boolean onStartTurn(); - - /** - * @see BuffHook#onEndTurn(Buff, Turn) - */ - public void onEndTurn(Turn turn); - - /** - * @see BuffHook#onCastDamage(Buff, Damage, Fighter) - */ - public void onCastDamage(Damage damage, Fighter target); - - /** - * @see BuffHook#onEffectValueCast(Buff, EffectValue) - */ - public void onEffectValueCast(EffectValue value); - - /** - * @see BuffHook#onEffectValueTarget(Buff, EffectValue) - */ - public void onEffectValueTarget(EffectValue value); - - /** - * @see BuffHook#onCharacteristicAltered(Buff, Characteristic, int) - */ - public void onCharacteristicAltered(Characteristic characteristic, int value); + public void add(B buff); /** * Refresh the buff list after turn end @@ -132,7 +36,7 @@ public interface Buffs extends Iterable { public void refresh(); /** - * Remove all buffs than can be removed, and fire {@link BuffHook#onBuffTerminated(Buff)} + * Remove all buffs than can be removed, and fire {@link BuffHook#onBuffTerminated(FightBuff)} * * @return true if there is at least one removed buff */ @@ -143,5 +47,5 @@ public interface Buffs extends Iterable { * * @return true if there is at least one removed buff */ - public boolean removeByCaster(Fighter caster); + public boolean removeByCaster(FighterData caster); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/FightBuff.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/FightBuff.java new file mode 100644 index 000000000..a0f28cdc7 --- /dev/null +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/FightBuff.java @@ -0,0 +1,131 @@ +/* + * This file is part of Araknemu. + * + * Araknemu is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Araknemu 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Araknemu. If not, see . + * + * Copyright (c) 2017-2019 Vincent Quatrevieux + */ + +package fr.quatrevieux.araknemu.game.fight.castable.effect.buff; + +import fr.quatrevieux.araknemu.game.fight.castable.Castable; +import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; +import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; +import org.checkerframework.checker.index.qual.GTENegativeOne; + +/** + * Persistent effect + * + * The duration will be taken from the effect. + * For overload the buff effect value (or duration), you must create a new effect instance + */ +public final class FightBuff implements Buff { + private final SpellEffect effect; + private final Castable action; + private final Fighter caster; + private final Fighter target; + private final BuffHook hook; + private final boolean canBeDispelled; + + private @GTENegativeOne int remainingTurns; + + public FightBuff(SpellEffect effect, Castable action, Fighter caster, Fighter target, BuffHook hook) { + this(effect, action, caster, target, hook, true); + } + + public FightBuff(SpellEffect effect, Castable action, Fighter caster, Fighter target, BuffHook hook, boolean canBeDispelled) { + this.effect = effect; + this.action = action; + this.caster = caster; + this.target = target; + this.hook = hook; + this.canBeDispelled = canBeDispelled; + + this.remainingTurns = effect.duration(); + } + + @Override + public SpellEffect effect() { + return effect; + } + + /** + * Get the action which generates this buff + */ + public Castable action() { + return action; + } + + @Override + public Fighter caster() { + return caster; + } + + @Override + public Fighter target() { + return target; + } + + /** + * Remaining turns for the buff effect + * + * When this value reached 0, the buff should be removed + * In case of infinite effect, the returned value is -1 + */ + public @GTENegativeOne int remainingTurns() { + return remainingTurns; + } + + /** + * Decrements the remaining turns + * + * You should call {@link FightBuff#valid()} for check if the buff is still valid or not + */ + public void decrementRemainingTurns() { + if (remainingTurns > 0) { + --remainingTurns; + } + } + + /** + * Increment remaining turns + * Use this method when a self-buff is added + */ + public void incrementRemainingTurns() { + if (remainingTurns != -1) { + ++remainingTurns; + } + } + + /** + * Get the related hook for the buff + */ + public BuffHook hook() { + return hook; + } + + /** + * Check if the buff is still valid + */ + public boolean valid() { + return remainingTurns != 0; + } + + /** + * Check if the buff can be removed + */ + public boolean canBeDispelled() { + return canBeDispelled; + } +} diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/EffectHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/EffectHandler.java index 4d0f96921..4692d1fca 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/EffectHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/EffectHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.hook.HookedSpellEffect; import fr.quatrevieux.araknemu.game.fight.castable.validator.CastConstraintValidator; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -56,7 +56,7 @@ public interface EffectHandler extends CastConstraintValidator { * @param buff The buff to apply * @see fr.quatrevieux.araknemu.game.fight.castable.effect.hook.EffectHookHandler for more details */ - public default void applyFromHook(Buff buff) { + public default void applyFromHook(FightBuff buff) { final Fighter target = buff.target(); final FightCell cell = target.cell(); final Castable spell = buff.action(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandler.java index 6cab917c1..810e41aac 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -64,7 +64,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { spellEffect, caster, effect.targets(), - (target, effectValue) -> target.buffs().add(new Buff( + (target, effectValue) -> target.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, effectValue.value()), cast.action(), caster, @@ -75,7 +75,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { } @Override - public void onDamage(Buff buff, Damage value) { + public void onDamage(FightBuff buff, Damage value) { if (value.element().physical() != physical) { return; } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandler.java index 2863db89e..4cf6b4392 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandler.java @@ -21,7 +21,7 @@ import fr.arakne.utils.value.helper.RandomUtil; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; @@ -51,24 +51,24 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { apply(buff, value); } @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { apply(buff, damage); } /** * Modify the damage multiplier depending on the chance */ - private void apply(Buff buff, MultipliableDamage damage) { + private void apply(FightBuff buff, MultipliableDamage damage) { final boolean heal = !random.bool(Asserter.assertPercent(buff.effect().special())); if (heal) { diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandler.java index e8bf86ef4..84d24f381 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; @@ -41,12 +41,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { if (!supportsElement(buff, value.element())) { return; } @@ -71,7 +71,7 @@ public void onDirectDamage(Buff buff, Fighter caster, Damage value) { * * @return true if the armor supports the element */ - private boolean supportsElement(Buff buff, Element element) { + private boolean supportsElement(FightBuff buff, Element element) { return buff.effect().special() == 0 || Element.fromBitSet(buff.effect().special()).contains(element); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandler.java index c708e0049..a1c4a6983 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; @@ -45,12 +45,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { // Ignore self damage if (!caster.equals(buff.target())) { value.reflect( diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandler.java index 4893e89e6..8d2809af3 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandler.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectsUtils; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -53,12 +53,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onCastTarget(Buff buff, FightCastScope cast) { + public boolean onCastTarget(FightBuff buff, FightCastScope cast) { final Fighter caster = cast.caster(); final Fighter target = buff.target(); final Spell spell = cast.spell(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AbstractAlterCharacteristicHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AbstractAlterCharacteristicHandler.java index 7fdbf2386..b010f5e25 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AbstractAlterCharacteristicHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AbstractAlterCharacteristicHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -37,7 +37,7 @@ public abstract class AbstractAlterCharacteristicHandler implements EffectHandle /** * @param hook Buff hook which handle characteristic change - * @param canBeDispelled Added buff effect can be dispelled. See: {@link Buff#canBeDispelled()} + * @param canBeDispelled Added buff effect can be dispelled. See: {@link FightBuff#canBeDispelled()} */ public AbstractAlterCharacteristicHandler(AlterCharacteristicHook hook, boolean canBeDispelled) { this.hook = hook; @@ -58,7 +58,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { spellEffect, caster, effect.targets(), - (target, effectValue) -> target.buffs().add(new Buff( + (target, effectValue) -> target.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, effectValue.value()), cast.action(), caster, @@ -70,13 +70,13 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { } @Override - public void applyFromHook(Buff buff) { + public void applyFromHook(FightBuff buff) { final SpellEffect spellEffect = buff.effect(); final Fighter caster = buff.caster(); final Fighter target = buff.target(); final EffectValue effectValue = EffectValue.create(spellEffect, caster, target); - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, effectValue.value()), buff.action(), caster, @@ -87,12 +87,12 @@ public void applyFromHook(Buff buff) { } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { hook.onBuffStarted(buff); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { hook.onBuffTerminated(buff); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandler.java index d40a89fd8..6638d1753 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.point.AlterPointHook; -import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; +import fr.quatrevieux.araknemu.game.fight.fighter.PlayableFighter; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; /** @@ -42,7 +42,7 @@ public AddActionPointsHandler(Fight fight) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { fight.turnList().current().ifPresent(turn -> { - final ActiveFighter fighter = turn.fighter(); + final PlayableFighter fighter = turn.fighter(); final EffectValue value = EffectValue.create(effect.effect(), fighter, fighter); final int ap = value.value(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandler.java index b3cdd27c2..e8d3806ce 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandler.java @@ -22,12 +22,11 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; -import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; import fr.quatrevieux.araknemu.util.Asserter; import org.checkerframework.checker.index.qual.NonNegative; @@ -72,7 +71,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { final Fighter caster = cast.caster(); for (Fighter target : cast.targets()) { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( spellEffect, cast.action(), caster, @@ -110,7 +109,7 @@ public AddCharacteristicOnDamageHandler register(int effectId, Characteristic ch } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { final Fighter target = buff.target(); final int boostEffectId = buff.effect().min(); final AlterCharacteristicHook hook = hooksMapping.get(boostEffectId); @@ -125,7 +124,7 @@ public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damag return; } - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( BuffEffect.withCustomEffectAndDuration(buff.effect(), boostEffectId, Math.min(maximalValue, damage), Asserter.assertGTENegativeOne(buff.effect().special())), buff.action(), buff.caster(), @@ -134,13 +133,13 @@ public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damag )); } - private @NonNegative int currentBoostValue(Buff buff, FighterData target) { + private @NonNegative int currentBoostValue(FightBuff buff, Fighter target) { // Add 1 to duration in case of self damage final int expectedEffectDuration = buff.effect().special() + (target.equals(fight.turnList().currentFighter()) ? 1 : 0); int boost = 0; - for (Buff activeBuff : target.buffs()) { + for (FightBuff activeBuff : target.buffs()) { if (activeBuff.effect().effect() == buff.effect().min() && activeBuff.remainingTurns() == expectedEffectDuration && activeBuff.action().equals(buff.action()) diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandler.java index cbe12c3d8..e34d7487a 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.point.AlterPointHook; -import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; +import fr.quatrevieux.araknemu.game.fight.fighter.PlayableFighter; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; /** @@ -42,7 +42,7 @@ public AddMovementPointsHandler(Fight fight) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { fight.turnList().current().ifPresent(turn -> { - final ActiveFighter fighter = turn.fighter(); + final PlayableFighter fighter = turn.fighter(); final EffectValue value = EffectValue.create(effect.effect(), fighter, fighter); final int mp = value.value(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandler.java index 6ddfb6694..686226d22 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandler.java @@ -21,12 +21,13 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; /** * Buff effect for adding characteristic points * Unlike {@link AddCharacteristicHandler}, the buff cannot be dispelled * - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff#canBeDispelled() + * @see FightBuff#canBeDispelled() */ public final class AddNotDispellableCharacteristicHandler extends AbstractAlterCharacteristicHandler { public AddNotDispellableCharacteristicHandler(Fight fight, Characteristic characteristic) { diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHook.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHook.java index df8cc3662..81625f0a1 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHook.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHook.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; @@ -55,7 +55,7 @@ protected AlterCharacteristicHook(Fight fight, Characteristic characteristic, in } @Override - public final void onBuffStarted(Buff buff) { + public final void onBuffStarted(FightBuff buff) { final Fighter target = buff.target(); final int effectValue = buff.effect().min(); final int appliedValue = effectValue * multiplier; @@ -66,7 +66,7 @@ public final void onBuffStarted(Buff buff) { } @Override - public final void onBuffTerminated(Buff buff) { + public final void onBuffTerminated(FightBuff buff) { apply(buff, buff.target(), -buff.effect().min() * multiplier); } @@ -78,7 +78,7 @@ public final void onBuffTerminated(Buff buff) { * @param target Buff target * @param value Value to apply. Negative for removing, positive for adding */ - protected void apply(Buff buff, Fighter target, int value) { + protected void apply(FightBuff buff, Fighter target, int value) { target.characteristics().alter(characteristic, value); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHook.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHook.java index 247e88048..fb751559b 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHook.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHook.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -43,7 +43,7 @@ private AlterVitalityHook(Fight fight, int multiplier) { } @Override - protected void apply(Buff buff, Fighter target, int value) { + protected void apply(FightBuff buff, Fighter target, int value) { super.apply(buff, target, value); target.life().alterMax(buff.caster(), value); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandler.java index 3ceb795a3..c2d9f7c2d 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -55,7 +55,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { final SpellEffect spellEffect = effect.effect(); final Fighter caster = cast.caster(); - caster.buffs().add(new Buff( + caster.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, EffectValue.create(spellEffect, caster, caster).value()), cast.action(), caster, @@ -65,7 +65,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { final int value = buff.effect().min(); final FighterData target = buff.target(); @@ -74,7 +74,7 @@ public void onBuffStarted(Buff buff) { } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { buff.target().characteristics().alter(Characteristic.SIGHT_BOOST, -buff.effect().min()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandler.java index c38163c8b..e47696390 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -55,7 +55,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { final SpellEffect spellEffect = effect.effect(); final Fighter caster = cast.caster(); - caster.buffs().add(new Buff( + caster.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, EffectValue.create(spellEffect, caster, caster).value()), cast.action(), caster, @@ -65,7 +65,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { final int value = buff.effect().min(); final FighterData target = buff.target(); @@ -74,7 +74,7 @@ public void onBuffStarted(Buff buff) { } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { buff.target().characteristics().alter(Characteristic.SIGHT_BOOST, buff.effect().min()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandler.java index 7f9b599fe..d44829a47 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.point.AlterPointHook; -import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; +import fr.quatrevieux.araknemu.game.fight.fighter.PlayableFighter; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; /** @@ -42,7 +42,7 @@ public RemoveActionPointsHandler(Fight fight) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { fight.turnList().current().ifPresent(turn -> { - final ActiveFighter fighter = turn.fighter(); + final PlayableFighter fighter = turn.fighter(); final EffectValue value = EffectValue.create(effect.effect(), fighter, fighter); final int ap = turn.points().removeActionPoints(value.value()); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandler.java index 933e3ce8d..bd1982ace 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.point.AlterPointHook; -import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; +import fr.quatrevieux.araknemu.game.fight.fighter.PlayableFighter; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; /** @@ -42,7 +42,7 @@ public RemoveMovementPointsHandler(Fight fight) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { fight.turnList().current().ifPresent(turn -> { - final ActiveFighter fighter = turn.fighter(); + final PlayableFighter fighter = turn.fighter(); final EffectValue value = EffectValue.create(effect.effect(), fighter, fighter); final int mp = turn.points().removeMovementPoints(value.value()); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandler.java index b9214a01d..7d5099183 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandler.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -89,7 +89,7 @@ public final void buff(FightCastScope cast, FightCastScope.EffectScope effect) { EffectValue.forEachTargets(spellEffect, caster, effect.targets(), applier); if (applier.total() > 0) { - caster.buffs().add(new Buff( + caster.buffs().add(new FightBuff( BuffEffect.withCustomEffect(spellEffect, addEffectId, applier.total()), action, caster, @@ -119,7 +119,7 @@ public void accept(Fighter target, EffectValue effectValue) { final int value = effectValue.value(); total += value; - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( BuffEffect.withCustomEffect(spellEffect, removeEffectId, value), action, caster, diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractPointLostApplier.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractPointLostApplier.java index 73a56a0ba..a51b900c0 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractPointLostApplier.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractPointLostApplier.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -84,7 +84,7 @@ public final int apply(FightCastScope cast, Fighter target, SpellEffect effect) } if (lost > 0) { - target.buffs().add(new Buff(buffEffect(effect, lost), cast.action(), caster, target, hook)); + target.buffs().add(new FightBuff(buffEffect(effect, lost), cast.action(), caster, target, hook)); } return lost; diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractStealPointHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractStealPointHandler.java index e62d26789..c836d5e97 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractStealPointHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AbstractStealPointHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -75,7 +75,7 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { if (stolen > 0) { caster.buffs().add( - new Buff( + new FightBuff( BuffEffect.withCustomEffect(effect.effect(), addPointEffect, stolen), cast.action(), caster, diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHook.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHook.java index 82238bd03..6742b3590 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHook.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHook.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AlterCharacteristicHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.turn.TurnPoints; @@ -45,7 +45,7 @@ protected AlterPointHook(Fight fight, Characteristic characteristic, int multipl } @Override - protected void apply(Buff buff, Fighter target, int value) { + protected void apply(FightBuff buff, Fighter target, int value) { super.apply(buff, target, value); fight.turnList().current() diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplier.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplier.java index 791663403..c81eebfba 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplier.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplier.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; @@ -65,10 +65,10 @@ public DamageApplier(Element element, Fight fight) { * * @return The real damage value * - * @see DamageApplier#apply(Buff) For apply a buff damage (i.e. poison) - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDirectDamage(Fighter, Damage) The called buff hook - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onElementDamageApplied(Element, int) Hook called after damage are applied - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDirectDamageApplied(Fighter, int) Buff called when damage are applied + * @see DamageApplier#apply(FightBuff) For apply a buff damage (i.e. poison) + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDirectDamage(Fighter, Damage) The called buff hook + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onElementDamageApplied(Element, int) Hook called after damage are applied + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDirectDamageApplied(Fighter, int) Buff called when damage are applied */ public int apply(Fighter caster, SpellEffect effect, Fighter target, EffectValue value, @NonNegative int distance) { final Damage damage = computeDamage(caster, effect, target, value); @@ -92,10 +92,10 @@ public int apply(Fighter caster, SpellEffect effect, Fighter target, EffectValue * * @return The applied damage value. Negative for damage, or positive for heal. * - * @see DamageApplier#applyFixed(Buff, int) For apply a precomputed damage buff - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDirectDamage(Fighter, Damage) The called buff hook - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onElementDamageApplied(Element, int) Hook called after damage are applied - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDirectDamageApplied(Fighter, int) Buff called when damage are applied + * @see DamageApplier#applyFixed(FightBuff, int) For apply a precomputed damage buff + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDirectDamage(Fighter, Damage) The called buff hook + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onElementDamageApplied(Element, int) Hook called after damage are applied + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDirectDamageApplied(Fighter, int) Buff called when damage are applied */ public int applyFixed(Fighter caster, @NonNegative int value, Fighter target) { final Damage damage = createDamage(caster, target, value); @@ -118,9 +118,9 @@ public int applyFixed(Fighter caster, @NonNegative int value, Fighter target) { * * @return The applied damage value. Negative for damage, or positive for heal. * - * @see DamageApplier#applyFixed(Buff, int) Apply damage with the same way - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onIndirectDamage(Fighter, Damage) The called buff hook - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onElementDamageApplied(Element, int) Hook called after damage are applied + * @see DamageApplier#applyFixed(FightBuff, int) Apply damage with the same way + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onIndirectDamage(Fighter, Damage) The called buff hook + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onElementDamageApplied(Element, int) Hook called after damage are applied */ public int applyIndirectFixed(Fighter caster, @NonNegative int value, Fighter target) { final Damage damage = createDamage(caster, target, value); @@ -137,10 +137,10 @@ public int applyIndirectFixed(Fighter caster, @NonNegative int value, Fighter ta * * @return The real damage value * - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onBuffDamage(Buff, Damage) The called buff hook - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onElementDamageApplied(Element, int) Hook called after damage are applied + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onBuffDamage(FightBuff, Damage) The called buff hook + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onElementDamageApplied(Element, int) Hook called after damage are applied */ - public int apply(Buff buff) { + public int apply(FightBuff buff) { final Fighter target = buff.target(); final Fighter caster = buff.caster(); @@ -152,7 +152,7 @@ public int apply(Buff buff) { /** * Apply a fixed (i.e. precomputed) amount of damage on the target from a buff * - * Like {@link DamageApplier#apply(Buff)} : + * Like {@link DamageApplier#apply(FightBuff)} : * - resistance are applied * - buff damage buff are called * @@ -161,10 +161,10 @@ public int apply(Buff buff) { * * @return The applied damage value. Negative for damage, or positive for heal. * - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onBuffDamage(Buff, Damage) The called buff hook - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onElementDamageApplied(Element, int) Hook called after damage are applied + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onBuffDamage(FightBuff, Damage) The called buff hook + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onElementDamageApplied(Element, int) Hook called after damage are applied */ - public int applyFixed(Buff buff, @NonNegative int value) { + public int applyFixed(FightBuff buff, @NonNegative int value) { final Fighter target = buff.target(); final Damage damage = createDamage(buff.caster(), target, value); @@ -232,7 +232,7 @@ private int applyDirectDamage(Fighter caster, Damage damage, Fighter target) { * * @return The life change value. Negative for damage, positive for heal. */ - private int applyBuffDamage(Buff buff, Damage damage, Fighter target) { + private int applyBuffDamage(FightBuff buff, Damage damage, Fighter target) { target.buffs().onBuffDamage(buff, damage); return applyDamage(buff.caster(), damage, target); @@ -294,7 +294,7 @@ private void applyReflectedDamage(Fighter castTarget, Fighter caster, Damage dam } /** - * Create the damage object, and call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onCastDamage(Damage, Fighter)} + * Create the damage object, and call {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onCastDamage(Damage, Fighter)} * * @param caster The spell caster * @param target The effect target diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandler.java index f9094c1ce..c0b72ad71 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.AbstractAttenuableAreaEffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -53,17 +53,17 @@ protected boolean applyOnTarget(FightCastScope cast, SpellEffect effect, Fighter @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void applyFromHook(Buff buff) { + public void applyFromHook(FightBuff buff) { applier.apply(buff); } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { applier.apply(buff); return !buff.target().dead(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandler.java index 7775527e8..686b24b69 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -37,7 +37,7 @@ * The second effect parameter (i.e. max) is the damage to apply per amount of used AP * Damage are modified by {@link Element#FIRE} and other boosts * - * @see BuffHook#onEndTurn(Buff, Turn) The called hook + * @see BuffHook#onEndTurn(FightBuff, Turn) The called hook */ public final class DamageOnActionPointUseHandler implements EffectHandler, BuffHook { private final DamageApplier applier; @@ -54,12 +54,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onEndTurn(Buff buff, Turn turn) { + public void onEndTurn(FightBuff buff, Turn turn) { final int usedAP = turn.points().usedActionPoints(); final int minAP = buff.effect().min(); final Fighter caster = buff.caster(); @@ -70,7 +70,7 @@ public void onEndTurn(Buff buff, Turn turn) { } // Create a fake Buff object with computed damage to apply - applier.apply(new Buff( + applier.apply(new FightBuff( BuffEffect.fixed(buff.effect(), (usedAP / minAP) * buff.effect().max()), buff.action(), caster, diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandler.java index b572a62d8..a32b773ab 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.AbstractPreRollEffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -48,12 +48,12 @@ protected void applyOnTarget(FightCastScope cast, SpellEffect effect, Fighter ta @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { buff.target().life().damage(buff.caster(), EffectValue.create(buff.effect(), buff.caster(), buff.target()).value()); return !buff.target().dead(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandler.java index 88c280c37..1995c715f 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandler.java @@ -23,11 +23,10 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; -import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; /** @@ -68,25 +67,25 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void applyFromHook(Buff buff) { + public void applyFromHook(FightBuff buff) { applyBuff(buff); } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { applyBuff(buff); return !buff.target().dead(); } - private void applyBuff(Buff buff) { - final FighterData caster = buff.caster(); - final FighterData target = buff.target(); + private void applyBuff(FightBuff buff) { + final Fighter caster = buff.caster(); + final Fighter target = buff.target(); final int damage = caster.life().current() * (EffectValue.create(buff.effect(), caster, target)).value() / 100; applier.applyFixed(buff, damage); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandler.java index 817222738..5db3d5716 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.AbstractAttenuableAreaEffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -55,12 +55,12 @@ protected boolean applyOnTarget(FightCastScope cast, SpellEffect effect, Fighter @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { applyCasterHeal(applier.apply(buff), buff.caster()); return !buff.target().dead(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandler.java index 4ea0f43c2..139d6480b 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -41,12 +41,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { final Fighter target = buff.target(); apply(buff.caster(), buff.effect(), target); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandler.java index 055105f29..3c14f8ad7 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandler.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectsUtils; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.AbstractAttenuableAreaEffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -59,12 +59,12 @@ protected boolean applyOnTarget(FightCastScope cast, SpellEffect effect, Fighter @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { final Fighter caster = buff.caster(); final SpellEffect effect = buff.effect(); final Fighter target = buff.target(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandler.java index cb458d5e1..5492928c0 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandler.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.handler.heal; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; @@ -42,12 +42,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { final int percent = Asserter.assertPercent(buff.effect().special()); final int heal = value.value() * percent / 100; diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandler.java index b76d0eb63..acb6f8425 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -33,7 +33,7 @@ * * This effect is boosted by {@link Characteristic#INTELLIGENCE} and {@link Characteristic#HEALTH_BOOST} * - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onLifeAltered(int) + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onLifeAltered(int) */ public final class HealOnDamageHandler implements EffectHandler, BuffHook { @Override @@ -47,12 +47,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onLifeAltered(Buff buff, int value) { + public void onLifeAltered(FightBuff buff, int value) { if (value < 0) { apply(buff.caster(), buff.effect(), buff.target()); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandler.java index 2155df7a9..77b08b2ae 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -50,7 +50,7 @@ public void buff(FightCastScope cast, BaseCastScope.EffectSc final Fighter caster = cast.caster(); EffectValue.forEachTargets(spellEffect, caster, cast.targets(), (target, effectValue) -> { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, effectValue.value()), action, caster, @@ -61,12 +61,12 @@ public void buff(FightCastScope cast, BaseCastScope.EffectSc } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { buff.target().characteristics().alterDiscernment(buff.effect().min()); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { buff.target().characteristics().alterDiscernment(-buff.effect().min()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandler.java index b86ff2db9..5fcfe81c0 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -49,7 +49,7 @@ public void buff(FightCastScope cast, BaseCastScope.EffectSc final Fighter caster = cast.caster(); EffectValue.forEachTargets(spellEffect, caster, cast.targets(), (target, effectValue) -> { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( BuffEffect.fixed(spellEffect, effectValue.value()), action, caster, @@ -60,12 +60,12 @@ public void buff(FightCastScope cast, BaseCastScope.EffectSc } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { buff.target().life().alterErosion(buff.effect().min()); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { buff.target().life().alterErosion(-buff.effect().min()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandler.java index 510772507..dc8fbb1df 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -53,7 +53,7 @@ public ApplySpellOnStartTurnHandler(Fight fight, SpellService spellService) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - final Buff buff = new Buff(effect.effect(), cast.action(), cast.caster(), target, this); + final FightBuff buff = new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this); // The duration must be at least 1 to ensure that the effect will be applied at the next start turn buff.incrementRemainingTurns(); @@ -64,12 +64,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { final Fighter target = buff.target(); final FightCell cell = target.cell(); final Spell spell = spellService.get(buff.effect().min()) diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandler.java index 038e958dc..edcab1fec 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandler.java @@ -21,8 +21,8 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -45,7 +45,7 @@ public ChangeAppearanceHandler(Fight fight) { public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { final int newGfxId = effect.effect().special(); - for (FighterData target : effect.targets()) { + for (Fighter target : effect.targets()) { if (newGfxId > 0) { // Positive effect : change the appearance fight.send(ActionEffect.changeAppearance(cast.caster(), target, newGfxId, 1)); @@ -59,12 +59,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { final FighterData caster = buff.caster(); final FighterData target = buff.target(); @@ -77,10 +77,10 @@ public void onBuffStarted(Buff buff) { /** * Get the current active appearance sprite id */ - private int getCurrentGfxId(FighterData fighter) { + private int getCurrentGfxId(Fighter fighter) { int gfxId = fighter.sprite().gfxId(); - for (Buff buff : fighter.buffs()) { + for (FightBuff buff : fighter.buffs()) { if (buff.hook() instanceof ChangeAppearanceHandler) { gfxId = buff.effect().special(); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandler.java index 649778bf4..1a3c52bb0 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandler.java @@ -21,9 +21,9 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; -import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; +import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.network.game.out.fight.AddBuff; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; @@ -47,12 +47,12 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { - for (FighterData fighter : effect.targets()) { + for (Fighter fighter : effect.targets()) { fighter.buffs().removeAll(); fight.send(ActionEffect.dispelBuffs(cast.caster(), fighter)); // Send not dispellable buffs - for (Buff buff : fighter.buffs()) { + for (FightBuff buff : fighter.buffs()) { fight.send(new AddBuff(buff)); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandler.java index 231308d5b..2451b39a2 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandler.java @@ -24,8 +24,8 @@ import fr.quatrevieux.araknemu.game.fight.castable.Castable; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectsUtils; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -67,17 +67,17 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { final Castable action = cast.action(); for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(spellEffect, action, caster, target, this)); + target.buffs().add(new FightBuff(spellEffect, action, caster, target, this)); } } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { buff.target().setHidden(buff.caster(), true); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { final Fighter target = buff.target(); // Set visible only if not yet visible and there is no other active invisibility buff @@ -87,7 +87,7 @@ public void onBuffTerminated(Buff buff) { } @Override - public void onCast(Buff buff, FightCastScope cast) { + public void onCast(FightBuff buff, FightCastScope cast) { // #301: do not show cell nor reveal caster if the cast is indirect (e.g. glyph, trap) if (cast.indirect()) { return; @@ -114,8 +114,8 @@ public void onCast(Buff buff, FightCastScope cast) { /** * Check if another active invisibility buff is present */ - private boolean hasOtherInvisibilityBuff(FighterData fighter) { - for (Buff activeBuff : fighter.buffs()) { + private boolean hasOtherInvisibilityBuff(Fighter fighter) { + for (FightBuff activeBuff : fighter.buffs()) { // Another invisibility buff exists : do not set target visible if (activeBuff.valid() && activeBuff.hook() == this) { return true; @@ -143,8 +143,8 @@ private boolean hasDirectDamageEffect(FightCastScope cast) { /** * Check if the given buff is the first of the buff list */ - private boolean isFirstInvisibilityBuff(FighterData fighter, Buff currentBuff) { - for (Buff otherBuff : fighter.buffs()) { + private boolean isFirstInvisibilityBuff(Fighter fighter, FightBuff currentBuff) { + for (FightBuff otherBuff : fighter.buffs()) { if (otherBuff.hook() == this) { // Current buff is not the first active invisibility buff return otherBuff == currentBuff; diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandler.java index 8102aafa3..2d71d061b 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -40,7 +40,7 @@ public SkipTurnHandler(Fight fight) { @Override public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - final Buff buff = new Buff(effect.effect(), cast.action(), cast.caster(), target, this); + final FightBuff buff = new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this); // The duration must be at least 1 to ensure that the next turn will be skipped buff.incrementRemainingTurns(); @@ -51,17 +51,17 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onStartTurn(Buff buff) { + public boolean onStartTurn(FightBuff buff) { return false; } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { fight.send(ActionEffect.skipNextTurn(buff.caster(), buff.target())); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandler.java index e03bfa202..d8784a025 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandler.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.handler.modifier; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -37,8 +37,8 @@ * Note: There is no game action packet related to this effect * * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterSpellList#boost(int, SpellsBoosts.Modifier, int) - * @see BuffHook#onBuffStarted(Buff) Hook used for apply the boost - * @see BuffHook#onBuffTerminated(Buff) Hook used for removed the boost + * @see BuffHook#onBuffStarted(FightBuff) Hook used for apply the boost + * @see BuffHook#onBuffTerminated(FightBuff) Hook used for removed the boost */ public final class BoostSpellHandler implements EffectHandler, BuffHook { private final SpellsBoosts.Modifier modifier; @@ -58,17 +58,17 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { buff.target().spells().boost(buff.effect().min(), modifier, buff.effect().special()); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { buff.target().spells().boost(buff.effect().min(), modifier, -buff.effect().special()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandler.java index 410bf4f5d..e2eab5baa 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandler.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.BaseCastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.closeCombat.CastableWeapon; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -51,21 +51,21 @@ public void handle(FightCastScope cast, BaseCastScope.Effect @Override public void buff(FightCastScope cast, BaseCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onBuffStarted(Buff buff) { + public void onBuffStarted(FightBuff buff) { weapon(buff).ifPresent(weapon -> weapon.increaseAbility(buff.effect().max())); } @Override - public void onBuffTerminated(Buff buff) { + public void onBuffTerminated(FightBuff buff) { weapon(buff).ifPresent(weapon -> weapon.decreaseAbility(buff.effect().max())); } - private Optional weapon(Buff buff) { + private Optional weapon(FightBuff buff) { return buff.target().closeCombat() .filter(CastableWeapon.class::isInstance) .map(CastableWeapon.class::cast) diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandler.java index e65e1c30e..db7b30a32 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -40,12 +40,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandler.java index 07908a690..5801a9606 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -40,12 +40,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onEffectValueCast(Buff buff, EffectValue value) { + public void onEffectValueCast(FightBuff buff, EffectValue value) { value.minimize(); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandler.java index 7dfb9590c..ee5d70001 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandler.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.handler.modifier; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; @@ -42,12 +42,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public void onCastDamage(Buff buff, Damage damage, Fighter target) { + public void onCastDamage(FightBuff buff, Damage damage, Fighter target) { damage.multiply(buff.effect().min()); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandler.java index 7c0f4e3c4..255973819 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandler.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectsUtils; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -54,12 +54,12 @@ public void handle(FightCastScope cast, FightCastScope.EffectScope effect) { @Override public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, this)); } } @Override - public boolean onCastTarget(Buff buff, FightCastScope cast) { + public boolean onCastTarget(FightBuff buff, FightCastScope cast) { if (!isDamageCast(cast) || buff.target().cell().coordinate().distance(cast.from()) != 1) { return true; } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandler.java index e75441fef..e0cd09ab6 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandler.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectsUtils; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.ReflectedDamage; @@ -53,13 +53,13 @@ public void buff(FightCastScope cast, FightCastScope.EffectScope effect) { for (Fighter target : effect.targets()) { if (!target.equals(caster)) { - target.buffs().add(new Buff(effect.effect(), cast.action(), caster, target, this)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), caster, target, this)); } } } @Override - public boolean onCastTarget(Buff buff, FightCastScope cast) { + public boolean onCastTarget(FightBuff buff, FightCastScope cast) { if (!isDamageCast(cast)) { return true; } @@ -74,7 +74,7 @@ public boolean onCastTarget(Buff buff, FightCastScope cast) { } @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { final Fighter buffCaster = buff.caster(); final Fighter target = buff.target(); diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/AbstractEffectHookHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/AbstractEffectHookHandler.java index 9250405be..c099ee13a 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/AbstractEffectHookHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/AbstractEffectHookHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.BaseCastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -55,7 +55,7 @@ public final boolean apply(EffectHandler handler, FightCastScope cast, BaseCastS final BuffHook hook = createHook(handler); for (Fighter target : effect.targets()) { - target.buffs().add(new Buff(effect.effect(), cast.action(), cast.caster(), target, hook)); + target.buffs().add(new FightBuff(effect.effect(), cast.action(), cast.caster(), target, hook)); } return false; diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLost.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLost.java index d12877c23..86c7d5653 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLost.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLost.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.hook; import fr.quatrevieux.araknemu.data.constant.Characteristic; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -32,7 +32,7 @@ public final class ApplyOnActionPointLost extends AbstractEffectHookHandler { protected BuffHook createHook(EffectHandler handler) { return new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { if (value >= 0 || characteristic != Characteristic.ACTION_POINT) { return; } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamage.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamage.java index a4bfa87fc..eba829d1b 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamage.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamage.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.hook; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import org.checkerframework.checker.index.qual.NonNegative; @@ -39,7 +39,7 @@ public ApplyOnElementDamage(Element element) { protected BuffHook createHook(EffectHandler handler) { return new BuffHook() { @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { if (ApplyOnElementDamage.this.element == element) { handler.applyFromHook(buff); } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHeal.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHeal.java index 9025422d6..f5bcc0d45 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHeal.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHeal.java @@ -19,7 +19,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.hook; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; @@ -31,7 +31,7 @@ public final class ApplyOnHeal extends AbstractEffectHookHandler { protected BuffHook createHook(EffectHandler handler) { return new BuffHook() { @Override - public void onHealApplied(Buff buff, int value) { + public void onHealApplied(FightBuff buff, int value) { handler.applyFromHook(buff); } }; diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/EffectHookHandler.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/EffectHookHandler.java index 0b7f7e867..eb47100aa 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/EffectHookHandler.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/EffectHookHandler.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.BaseCastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; /** @@ -30,7 +30,7 @@ * * The expecting behavior of this handler is: * - Create buff hook instance, taking the effect handler as parameter. - * - Implements the required hook methods, and call {@link EffectHandler#applyFromHook(Buff)} to apply the effect. + * - Implements the required hook methods, and call {@link EffectHandler#applyFromHook(FightBuff)} to apply the effect. * - Add a buff to each target, following the original effect target. * The buff is created and added by the implementation of this handler, and take the previously created hook as parameter. * - Return false to prevent the effect to be applied directly, or true to apply it. diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/HookedSpellEffect.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/HookedSpellEffect.java index 875f7050c..c3fb23f4d 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/HookedSpellEffect.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/HookedSpellEffect.java @@ -19,7 +19,7 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.hook; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; import fr.quatrevieux.araknemu.game.spell.effect.area.CellArea; import fr.quatrevieux.araknemu.game.spell.effect.area.SpellEffectArea; @@ -32,7 +32,7 @@ * Decorate a spell effect to remove the area and target, * so it can be safely used to apply an effect from a hook (the effect will be applied only on the target of the buff) * - * @see fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler#applyFromHook(Buff) + * @see fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler#applyFromHook(FightBuff) * */ public final class HookedSpellEffect implements SpellEffect { diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterData.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterData.java index 61c16b836..3ff06f895 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterData.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterData.java @@ -19,6 +19,7 @@ package fr.quatrevieux.araknemu.game.fight.fighter; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs; import fr.quatrevieux.araknemu.game.fight.map.BattlefieldCell; import fr.quatrevieux.araknemu.game.fight.team.Team; @@ -55,7 +56,7 @@ public interface FighterData extends Creature { /** * Get the current buffs */ - public Buffs buffs(); + public Buffs buffs(); /** * Get the fighter states diff --git a/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterLife.java b/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterLife.java index 537d7af0d..1e7fc63f5 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterLife.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/fight/fighter/FighterLife.java @@ -38,7 +38,7 @@ public interface FighterLife extends Life { * If the fighter is dead, or is full life, this method will do nothing * If the value is higher that the current life left, the life will be set to the max life * - * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onHealApplied(int)} + * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onHealApplied(int)} * * @param caster The caster of the heal effect * @param value The heal value @@ -53,7 +53,7 @@ public interface FighterLife extends Life { * If the fighter is dead, this method will do nothing * If the value is higher that the current life, the fighter will be considered as dead, and its life will be set to 0 * - * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDamageApplied(int)} + * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDamageApplied(int)} * * @param caster The caster of the damage effect * @param value The damage value @@ -72,7 +72,7 @@ public interface FighterLife extends Life { * If the fighter is dead, this method will do nothing * If the value is higher that the current life, the fighter will be considered as dead, and its life will be set to 0 * - * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs#onDamageApplied(int)} + * This method will trigger buffs {@link fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffListHooks#onDamageApplied(int)} * * @param caster The caster of the damage effect * @param value The damage value diff --git a/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuff.java b/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuff.java index 97e1979e5..8de4a263e 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuff.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuff.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.core.event.Listener; import fr.quatrevieux.araknemu.game.fight.Fight; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.event.FighterDie; import fr.quatrevieux.araknemu.network.game.out.fight.AddBuff; @@ -72,7 +72,7 @@ private void synchronizeBuffs() { fight.send(new ClearAllBuffs()); for (Fighter fighter : fight.fighters()) { - for (Buff buff : fighter.buffs()) { + for (FightBuff buff : fighter.buffs()) { fight.send(new AddBuff(buff)); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectator.java b/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectator.java index f0865022b..9408df2ec 100644 --- a/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectator.java +++ b/src/main/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectator.java @@ -22,8 +22,8 @@ import fr.quatrevieux.araknemu.core.event.Listener; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FighterList; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buffs; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffList; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.spectator.Spectator; @@ -81,8 +81,8 @@ public Class event() { /** * Send all buffs of a fighter to the spectator */ - private void sendBuffs(Buffs buffs) { - for (Buff buff : buffs) { + private void sendBuffs(BuffList buffs) { + for (FightBuff buff : buffs) { spectator.send(new AddBuff(buff)); } } diff --git a/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuff.java b/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuff.java index 33a5584f4..2ca36dee5 100644 --- a/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuff.java +++ b/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuff.java @@ -19,16 +19,16 @@ package fr.quatrevieux.araknemu.network.game.out.fight; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.spell.Spell; /** * Add buff to fighter */ public final class AddBuff { - private final Buff buff; + private final FightBuff buff; - public AddBuff(Buff buff) { + public AddBuff(FightBuff buff) { this.buff = buff; } diff --git a/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffect.java b/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffect.java index df299045a..256efa53a 100644 --- a/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffect.java +++ b/src/main/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffect.java @@ -19,7 +19,7 @@ package fr.quatrevieux.araknemu.network.game.out.fight.action; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.map.FightCell; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -143,7 +143,7 @@ public static ActionEffect returnSpell(FighterData fighter, boolean success) { * * @param buff The applied buff */ - public static ActionEffect buff(Buff buff, int value) { + public static ActionEffect buff(FightBuff buff, int value) { return new ActionEffect(buff.effect().effect(), buff.caster(), buff.target().id(), value, buff.effect().duration()); } diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/SimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/SimulatorTest.java index 1a9469ae0..8750d4b92 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/SimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/SimulatorTest.java @@ -30,6 +30,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.fighter.invocation.DoubleFighter; @@ -358,7 +359,7 @@ void applyReduceableDamageBuffsWithoutBuff() { @Test void applyReduceableDamageBuffsWithBuffNotMatching() { other.fighter().buffs().add( - new Buff( + new FightBuff( new SpellEffectStub(100, 10), Mockito.mock(Spell.class), other.fighter(), @@ -389,7 +390,7 @@ public Damage onReduceableDamage(CastSimulation simulation, Buff buff, FighterDa @Test void applyReduceableDamageBuffsWithBuffMatching() { other.fighter().buffs().add( - new Buff( + new FightBuff( new SpellEffectStub(100, 10), Mockito.mock(Spell.class), other.fighter(), @@ -422,7 +423,7 @@ public Damage onReduceableDamage(CastSimulation simulation, Buff buff, FighterDa @Test void applyReduceableDamageBuffsWithBuffMatchingReturnedNewInstance() { other.fighter().buffs().add( - new Buff( + new FightBuff( new SpellEffectStub(100, 20), Mockito.mock(Spell.class), other.fighter(), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ArmorSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ArmorSimulatorTest.java index 03cf9047b..df8178ea6 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ArmorSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ArmorSimulatorTest.java @@ -30,7 +30,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.simulation.SpellScore; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -213,7 +213,7 @@ void score() { @Test void onReduceableDamageSuccess() { Damage damage = new Damage(10, Element.EARTH); - Buff buff = new Buff( + FightBuff buff = new FightBuff( SpellEffectStub.fixed(105, 3), Mockito.mock(Spell.class), other.fighter(), @@ -234,7 +234,7 @@ void onReduceableDamageShouldBeBoostedByIntelligence() { other.fighter().characteristics().alter(Characteristic.INTELLIGENCE, 100); Damage damage = new Damage(10, Element.EARTH); - Buff buff = new Buff( + FightBuff buff = new FightBuff( SpellEffectStub.fixed(105, 3), Mockito.mock(Spell.class), other.fighter(), @@ -255,7 +255,7 @@ void onReduceableDamageShouldIgnoreNegativeReduce() { other.fighter().characteristics().alter(Characteristic.INTELLIGENCE, -1000); Damage damage = new Damage(10, Element.EARTH); - Buff buff = new Buff( + FightBuff buff = new FightBuff( SpellEffectStub.fixed(105, 3), Mockito.mock(Spell.class), other.fighter(), @@ -276,7 +276,7 @@ void onReduceableDamageShouldBeBoostedByDamageElement() { other.fighter().characteristics().alter(Characteristic.STRENGTH, 100); Damage damage = new Damage(10, Element.EARTH); - Buff buff = new Buff( + FightBuff buff = new FightBuff( SpellEffectStub.fixed(105, 3), Mockito.mock(Spell.class), other.fighter(), @@ -296,7 +296,7 @@ void onReduceableDamageShouldBeBoostedByDamageElement() { void onReduceableDamageShouldFilterDamageElement() { other.fighter().characteristics().alter(Characteristic.STRENGTH, 100); - Buff buff = new Buff( + FightBuff buff = new FightBuff( SpellEffectStub.fixed(105, 3).setSpecial(4), // Water Mockito.mock(Spell.class), other.fighter(), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/DamageSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/DamageSimulatorTest.java index 030fc4d92..a309f49a6 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/DamageSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/DamageSimulatorTest.java @@ -31,7 +31,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.simulation.SpellScore; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -184,7 +184,7 @@ void simulateWithCounterDamage() { @Test void simulateWithReduceDamageBuff() { other.fighter().buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(105, 5), Mockito.mock(Spell.class), fighter, @@ -199,7 +199,7 @@ void simulateWithReduceDamageBuff() { @Test void simulateWithCounterDamageBuff() { other.fighter().buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(107, 5), Mockito.mock(Spell.class), fighter, @@ -215,7 +215,7 @@ void simulateWithCounterDamageBuff() { @Test void simulateWithCounterDamageBuffNotFixedDamage() { other.fighter().buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(107, 5), Mockito.mock(Spell.class), fighter, @@ -231,7 +231,7 @@ void simulateWithCounterDamageBuffNotFixedDamage() { @Test void simulateWithReturnSpell() { other.fighter().buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(106, 5).setSpecial(100), Mockito.mock(Spell.class), fighter, diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeDamageSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeDamageSimulatorTest.java index 389bef7cf..ae561c495 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeDamageSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeDamageSimulatorTest.java @@ -31,6 +31,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -97,7 +98,7 @@ void simulateWithResistance() { @Test void simulateWithArmorBuff() { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( SpellEffectStub.fixed(105, 10), Mockito.mock(Spell.class), target, @@ -127,7 +128,7 @@ public Damage onReduceableDamage(CastSimulation simulation, Buff buff, FighterDa }); target.buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(999, 10), Mockito.mock(Spell.class), target, @@ -142,7 +143,7 @@ public Damage onReduceableDamage(CastSimulation simulation, Buff buff, FighterDa @Test void simulatePoisonShouldIgnoreArmor() { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( SpellEffectStub.fixed(105, 10), Mockito.mock(Spell.class), target, diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeLostDamageSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeLostDamageSimulatorTest.java index 2131b080f..975cc769f 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeLostDamageSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/PercentLifeLostDamageSimulatorTest.java @@ -32,6 +32,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -83,7 +84,7 @@ void simulateSimple() { @Test void simulateWithArmorBuff() { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( SpellEffectStub.fixed(105, 5), Mockito.mock(Spell.class), target, @@ -116,7 +117,7 @@ public Damage onReduceableDamage(CastSimulation simulation, Buff buff, FighterDa }); target.buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(999, 10), Mockito.mock(Spell.class), target, @@ -186,7 +187,7 @@ void simulateBuff() { @Test void simulatePoisonShouldIgnoreArmorBuff() { - target.buffs().add(new Buff( + target.buffs().add(new FightBuff( SpellEffectStub.fixed(105, 5), Mockito.mock(Spell.class), target, diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ReflectDamageSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ReflectDamageSimulatorTest.java index c4bf3934d..eb743c135 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ReflectDamageSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/ReflectDamageSimulatorTest.java @@ -30,7 +30,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.simulation.SpellScore; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -188,7 +188,7 @@ void onReduceableDamageSuccess() { CastSimulation simulation = new CastSimulation(spell, fighter, fighter.cell()); Damage damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 5), Mockito.mock(Spell.class), fighter, @@ -206,7 +206,7 @@ void onReduceableDamageSuccess() { damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 5), Mockito.mock(Spell.class), fighter, diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/SpellReturnSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/SpellReturnSimulatorTest.java index 1b8c55e6a..3ab34e40e 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/SpellReturnSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/SpellReturnSimulatorTest.java @@ -29,7 +29,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.simulation.SpellScore; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -175,7 +175,7 @@ void onReduceableDamageSuccess() { CastSimulation simulation = new CastSimulation(spell, fighter, fighter.cell()); Damage damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 5).setSpecial(100), Mockito.mock(Spell.class), fighter, @@ -208,7 +208,7 @@ void onReduceableDamageLevelTooLow() { CastSimulation simulation = new CastSimulation(spell, fighter, fighter.cell()); Damage damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 4).setSpecial(100), Mockito.mock(Spell.class), fighter, @@ -241,7 +241,7 @@ void onReduceableProbabilityTooLow() { CastSimulation simulation = new CastSimulation(spell, fighter, fighter.cell()); Damage damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 5).setSpecial(50), Mockito.mock(Spell.class), fighter, @@ -274,7 +274,7 @@ void onReduceableDamageShouldIgnoreNegativeDamage() { CastSimulation simulation = new CastSimulation(spell, fighter, fighter.cell()); Damage damage = simulator.onReduceableDamage( simulation, - new Buff( + new FightBuff( SpellEffectStub.fixed(100, 5).setSpecial(100), Mockito.mock(Spell.class), fighter, diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/StealLifeSimulatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/StealLifeSimulatorTest.java index 5f28466f8..97dccb0f3 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/StealLifeSimulatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/ai/simulation/effect/StealLifeSimulatorTest.java @@ -31,7 +31,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.simulation.SpellScore; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -85,7 +85,7 @@ void simulateWithCounterDamage() { @Test void simulateWithArmorBuff() { other.fighter().buffs().add( - new Buff( + new FightBuff( SpellEffectStub.fixed(105, 10), Mockito.mock(Spell.class), other.fighter(), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectValueTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectValueTest.java index f32784441..d8ff9c568 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectValueTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectValueTest.java @@ -22,7 +22,7 @@ import fr.arakne.utils.value.Interval; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -263,8 +263,8 @@ void createShouldCallBuffs() throws Exception { BuffHook casterHook = Mockito.mock(BuffHook.class); BuffHook targetHook = Mockito.mock(BuffHook.class); - Buff casterBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); - Buff targetBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); + FightBuff casterBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); + FightBuff targetBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); caster.buffs().add(casterBuff); target.buffs().add(targetBuff); @@ -291,8 +291,8 @@ void forEachTargetsShouldCallBuffs() throws Exception { BuffHook casterHook = Mockito.mock(BuffHook.class); BuffHook targetHook = Mockito.mock(BuffHook.class); - Buff casterBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); - Buff targetBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); + FightBuff casterBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); + FightBuff targetBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); caster.buffs().add(casterBuff); target.buffs().add(targetBuff); @@ -328,9 +328,9 @@ void forEachTargetsWithMaximizeOnOneTarget() throws Exception { Fighter caster = player.fighter(); Fighter target = other.fighter(); - Buff targetBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff targetBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } }); @@ -365,8 +365,8 @@ void preRoll() throws Exception { BuffHook casterHook = Mockito.mock(BuffHook.class); BuffHook targetHook = Mockito.mock(BuffHook.class); - Buff casterBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); - Buff targetBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); + FightBuff casterBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); + FightBuff targetBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); caster.buffs().add(casterBuff); target.buffs().add(targetBuff); @@ -396,9 +396,9 @@ void preRollWithMaximizeOnOneTarget() throws Exception { Fighter caster = player.fighter(); Fighter target = other.fighter(); - Buff maximuzeBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff maximuzeBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } }); @@ -407,8 +407,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { BuffHook casterHook = Mockito.mock(BuffHook.class); BuffHook targetHook = Mockito.mock(BuffHook.class); - Buff casterBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); - Buff targetBuff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); + FightBuff casterBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, casterHook); + FightBuff targetBuff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, targetHook); caster.buffs().add(casterBuff); target.buffs().add(targetBuff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandlerTest.java index 30e369635..c5904a9d1 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/EffectsHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.CastScope; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.EffectHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageHandler; @@ -42,7 +42,6 @@ import org.apache.logging.log4j.Logger; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.Mock; import org.mockito.Mockito; import java.sql.SQLException; @@ -152,7 +151,7 @@ void applyDamageBuff() { Mockito.when(constraints.freeCell()).thenReturn(false); handler.apply(makeCastScope(player.fighter(), spell, effect, other.fighter().cell())); - Optional found = other.fighter().buffs().stream().filter(buff -> buff.effect().effect() == 100).findFirst(); + Optional found = other.fighter().buffs().stream().filter(buff -> buff.effect().effect() == 100).findFirst(); assertTrue(found.isPresent()); assertEquals(player.fighter(), found.get().caster()); @@ -179,7 +178,7 @@ void applyInfiniteDurationEffect() { Mockito.when(constraints.freeCell()).thenReturn(false); handler.apply(makeCastScope(player.fighter(), spell, effect, other.fighter().cell())); - Optional found = other.fighter().buffs().stream().filter(buff -> buff.effect().effect() == 100).findFirst(); + Optional found = other.fighter().buffs().stream().filter(buff -> buff.effect().effect() == 100).findFirst(); assertTrue(found.isPresent()); assertEquals(player.fighter(), found.get().caster()); @@ -271,7 +270,7 @@ void applyWillCallBuffOnCastTarget() { Mockito.when(constraints.freeCell()).thenReturn(false); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(effect, spell, player.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, spell, player.fighter(), player.fighter(), hook); other.fighter().buffs().add(buff); FightCastScope cast = makeCastScope(player.fighter(), spell, effect, other.fighter().cell()); @@ -293,7 +292,7 @@ void applyWillCallBuffOnCaster() { Mockito.when(constraints.freeCell()).thenReturn(false); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(effect, spell, player.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, spell, player.fighter(), player.fighter(), hook); player.fighter().buffs().add(buff); FightCastScope cast = makeCastScope(player.fighter(), spell, effect, other.fighter().cell()); @@ -315,11 +314,11 @@ void applyWithCastTargetChangedShouldCallOnCastTargetOnNewTarget() { Mockito.when(constraints.freeCell()).thenReturn(false); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(effect, spell, player.fighter(), other.fighter(), hook); + FightBuff buff = new FightBuff(effect, spell, player.fighter(), other.fighter(), hook); other.fighter().buffs().add(buff); BuffHook hook2 = Mockito.mock(BuffHook.class); - Buff buff2 = new Buff(effect, spell, player.fighter(), player.fighter(), hook2); + FightBuff buff2 = new FightBuff(effect, spell, player.fighter(), player.fighter(), hook2); player.fighter().buffs().add(buff2); FightCastScope cast = makeCastScope(player.fighter(), spell, effect, other.fighter().cell()); @@ -351,7 +350,7 @@ void applyDamageThroughHook() { handler.apply(makeCastScope(player.fighter(), spell, effect, other.fighter().cell())); - Optional buff = other.fighter().buffs().stream().filter(b -> b.effect().effect() == 100).findFirst(); + Optional buff = other.fighter().buffs().stream().filter(b -> b.effect().effect() == 100).findFirst(); assertTrue(buff.isPresent()); requestStack.assertLast(new AddBuff(buff.get())); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/FunctionalTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/FunctionalTest.java index f82391acc..a4194249a 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/FunctionalTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/FunctionalTest.java @@ -27,7 +27,7 @@ import fr.quatrevieux.araknemu.game.fight.ai.factory.AiFactory; import fr.quatrevieux.araknemu.game.fight.castable.closeCombat.CastableWeapon; import fr.quatrevieux.araknemu.game.fight.castable.closeCombat.CloseCombatValidator; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AddCharacteristicHandler; import fr.quatrevieux.araknemu.game.fight.castable.spell.SpellConstraintsValidator; import fr.quatrevieux.araknemu.game.fight.exception.FightException; @@ -131,8 +131,8 @@ public void setUp() throws Exception { void poisonSpell() { castNormal(181, fighter1.cell()); // Tremblement - Optional buff1 = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 99).findFirst(); - Optional buff2 = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 99).findFirst(); + Optional buff1 = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 99).findFirst(); + Optional buff2 = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 99).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -171,7 +171,7 @@ void poisonSpell() { void skipNextTurn() { castNormal(1630, fighter2.cell()); - Optional found = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 140).findFirst(); + Optional found = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 140).findFirst(); assertTrue(found.isPresent()); assertEquals(140, found.get().effect().effect()); @@ -237,10 +237,10 @@ void returnSpell() { void pointsChange() { castNormal(115, fighter1.cell()); // Odorat - Optional addAp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); - Optional remAp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); - Optional addMp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); - Optional remMp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); + Optional addAp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); + Optional remAp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); + Optional addMp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); + Optional remMp = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); assertTrue(addAp.isPresent()); assertTrue(remAp.isPresent()); @@ -273,7 +273,7 @@ void pointsChange() { void addCharacteristic() { castNormal(42, fighter1.cell()); // Chance - Optional addLuck = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional addLuck = fighter1.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(addLuck.isPresent()); assertBetween(51, 60, addLuck.get().effect().min()); @@ -289,7 +289,7 @@ void addCharacteristic() { void removeCharacteristic() { castNormal(468, fighter2.cell()); // Flêche d'huile - Optional removeIntel = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 155).findFirst(); + Optional removeIntel = fighter2.buffs().stream().filter(buff -> buff.effect().effect() == 155).findFirst(); assertTrue(removeIntel.isPresent()); assertEquals(400, removeIntel.get().effect().min()); @@ -719,7 +719,7 @@ void actionPointLost() { castNormal(81, fighter2.cell()); // Ralentissement - Buff buff = fighter2.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); + FightBuff buff = fighter2.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); assertEquals(4, fighter2.characteristics().get(Characteristic.ACTION_POINT)); requestStack.assertOne(ActionEffect.buff(buff, -2)); @@ -737,7 +737,7 @@ void movementPointLost() { castNormal(50, fighter2.cell()); // Maladresse - Buff buff = fighter2.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); + FightBuff buff = fighter2.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); assertEquals(1, fighter2.characteristics().get(Characteristic.MOVEMENT_POINT)); requestStack.assertOne(ActionEffect.buff(buff, -2)); @@ -755,8 +755,8 @@ void stealActionPoints() { castNormal(98, fighter2.cell()); // Vol du Temps - Buff buffT = fighter2.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); - Buff buffC = fighter1.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst().get(); + FightBuff buffT = fighter2.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); + FightBuff buffC = fighter1.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst().get(); assertEquals(8, fighter1.characteristics().get(Characteristic.ACTION_POINT)); assertEquals(4, fighter1.turn().points().actionPoints()); @@ -784,7 +784,7 @@ void stealMovementPoints() { castNormal(170, fighter2.cell()); // Flèche Immobilisation - Buff buffT = fighter2.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); + FightBuff buffT = fighter2.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); assertEquals(4, fighter1.turn().points().movementPoints()); assertEquals(2, fighter2.characteristics().get(Characteristic.MOVEMENT_POINT)); @@ -1156,7 +1156,7 @@ void addCharacteristicOnDamage() { castNormal(183, fighter1.cell()); // Simple attack int damage = lifeBefore - fighter1.life().current(); - Buff buff = fighter1.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); + FightBuff buff = fighter1.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); assertEquals(damage, fighter1.characteristics().get(Characteristic.LUCK)); assertEquals(damage, buff.effect().min()); @@ -1175,7 +1175,7 @@ void addVitalityOnDamage() { castNormal(183, fighter1.cell()); // Simple attack int damage = fighter1.life().max() - fighter1.life().current(); - Buff buff = fighter1.buffs().stream().filter(b -> b.effect().effect() == 108).findFirst().get(); + FightBuff buff = fighter1.buffs().stream().filter(b -> b.effect().effect() == 108).findFirst().get(); assertEquals(damage, fighter1.characteristics().get(Characteristic.VITALITY)); assertEquals(295 + damage, fighter1.life().max()); @@ -2293,7 +2293,7 @@ void applyOnActionPointLost() { castNormal(81, fighter1.cell()); // Ralentissement assertEquals(8, fighter1.characteristics().get(Characteristic.ACTION_POINT)); - List buffs = fighter1.buffs().stream().filter(b -> b.effect().effect() == 111).collect(Collectors.toList()); + List buffs = fighter1.buffs().stream().filter(b -> b.effect().effect() == 111).collect(Collectors.toList()); assertCount(3, buffs); assertEquals(2, buffs.get(1).effect().min()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListTest.java index 6469b4fd2..6d98dc460 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/buff/BuffListTest.java @@ -66,13 +66,13 @@ void add() { SpellEffect effect = Mockito.mock(SpellEffect.class); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); list.add(buff); requestStack.assertLast(new AddBuff(buff)); Mockito.verify(hook).onBuffStarted(buff); - assertArrayEquals(new Buff[] {buff}, list.stream().toArray()); + assertArrayEquals(new FightBuff[] {buff}, list.stream().toArray()); } @Test @@ -83,7 +83,7 @@ void addWithDurationZero() { Mockito.when(effect.duration()).thenReturn(0); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); list.add(buff); @@ -97,7 +97,7 @@ void addWithInfiniteDuration() { Mockito.when(effect.duration()).thenReturn(-1); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); list.add(buff); @@ -113,15 +113,15 @@ void addWithInfiniteDuration() { @Test void addMultiple() { - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); list.add(buff3); - assertArrayEquals(new Buff[] {buff1, buff2, buff3}, list.stream().toArray()); + assertArrayEquals(new FightBuff[] {buff1, buff2, buff3}, list.stream().toArray()); } @Test @@ -134,7 +134,7 @@ void addWhenTurnIsActiveShouldIncrementRemainingTurns() { Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook); list.add(buff); @@ -151,7 +151,7 @@ void addWhenTurnIsActiveShouldIncrementRemainingTurnsWithADurationOfZero() { Mockito.when(effect.duration()).thenReturn(0); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook); list.add(buff); @@ -167,7 +167,7 @@ void onStartTurnWithoutBuff() { void onStartTurnWithOneBuffWillReturnTheBuffHookResponse() { SpellEffect effect = Mockito.mock(SpellEffect.class); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); Mockito.when(hook.onStartTurn(buff)).thenReturn(false); @@ -181,9 +181,9 @@ void onStartTurnWithOneBuffWillReturnTheBuffHookResponse() { void onStartTurnWithMultipleBuff() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); Mockito.when(hook1.onStartTurn(buff1)).thenReturn(true); Mockito.when(hook2.onStartTurn(buff2)).thenReturn(false); @@ -205,9 +205,9 @@ void onEndTurn() { Turn turn = Mockito.mock(Turn.class); BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -224,9 +224,9 @@ void onEndTurn() { void onCast() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -245,9 +245,9 @@ void onCast() { void onCastTarget() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -270,9 +270,9 @@ void onCastTarget() { void onCastTargetWithReturnFalseShouldStopNextHooks() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -295,9 +295,9 @@ void onCastTargetWithReturnFalseShouldStopNextHooks() { void onDirectDamage() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -317,9 +317,9 @@ void onDirectDamage() { void onDirectDamageApplied() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -338,9 +338,9 @@ void onDirectDamageApplied() { void onElementDamageApplied() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -358,16 +358,16 @@ void onElementDamageApplied() { @Test void addingBuffDuringHookCall() { BuffHook hook2 = Mockito.mock(BuffHook.class); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2); BuffHook hook1 = new BuffHook() { @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { list.add(buff2); } }; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1); list.add(buff1); @@ -383,9 +383,9 @@ public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damag void onIndirectDamage() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -405,16 +405,16 @@ void onIndirectDamage() { void onBuffDamage() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); list.add(buff3); Damage damage = new Damage(10, Element.NEUTRAL); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); list.onBuffDamage(buff, damage); @@ -427,9 +427,9 @@ void onBuffDamage() { void onDamageApplied() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -446,9 +446,9 @@ void onDamageApplied() { void onHealApplied() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -465,9 +465,9 @@ void onHealApplied() { void onReflectedDamage() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -486,9 +486,9 @@ void onReflectedDamage() { void onCastDamage() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -507,9 +507,9 @@ void onCastDamage() { void onEffectValueCast() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -528,9 +528,9 @@ void onEffectValueCast() { void onEffectValueTarget() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -549,9 +549,9 @@ void onEffectValueTarget() { void onCharacteristicAltered() { BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -576,9 +576,9 @@ void refreshWillDecrementRemaingTurnsAndRemoveExpiredBuffs() { Mockito.when(effect2.duration()).thenReturn(2); Mockito.when(effect3.duration()).thenReturn(3); - Buff buff1 = new Buff(effect1, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(effect2, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(effect3, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(effect1, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(effect2, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(effect3, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -586,7 +586,7 @@ void refreshWillDecrementRemaingTurnsAndRemoveExpiredBuffs() { list.refresh(); - assertArrayEquals(new Buff[] {buff2, buff3}, list.stream().toArray()); + assertArrayEquals(new FightBuff[] {buff2, buff3}, list.stream().toArray()); Mockito.verify(hook1).onBuffTerminated(buff1); } @@ -594,9 +594,9 @@ void refreshWillDecrementRemaingTurnsAndRemoveExpiredBuffs() { @Test void addMultipleAndRemoveThoseThatCanBeRemoved(){ BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class), false); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class), true); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class), false); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class), true); list.add(buff1); list.add(buff2); @@ -616,9 +616,9 @@ void addMultipleAndRemoveThoseThatCanBeRemoved(){ @Test void removeAllWithoutUndispellableBuff(){ BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class)); list.add(buff1); list.add(buff2); @@ -638,9 +638,9 @@ void removeAllWithoutUndispellableBuff(){ @Test void removeByCaster(){ BuffHook hook1, hook2, hook3; - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class), false); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class), true); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook1 = Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), hook2 = Mockito.mock(BuffHook.class), false); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook3 = Mockito.mock(BuffHook.class), true); list.add(buff1); list.add(buff2); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandlerTest.java index 1b920e9cf..693e1f36b 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/AlterResistanceHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -102,7 +102,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().effect() == 184).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().effect() == 184).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -116,9 +116,9 @@ void buff() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -139,8 +139,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -155,7 +155,7 @@ void onDirectDamageWillReduce() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -170,7 +170,7 @@ void onIndirectDamageWillReduce() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -185,7 +185,7 @@ void onDirectDamageWillIgnoreUnsupportedElement() { Mockito.when(returnEffect.min()).thenReturn(10); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); Damage damage = new Damage(20, Element.WATER); @@ -200,7 +200,7 @@ void increaseMagical() { SpellEffect returnEffect = Mockito.mock(SpellEffect.class); Mockito.when(returnEffect.min()).thenReturn(10); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); handler.onDirectDamage(buff, caster, damage); @@ -218,7 +218,7 @@ void reduceMagical() { SpellEffect returnEffect = Mockito.mock(SpellEffect.class); Mockito.when(returnEffect.min()).thenReturn(10); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); handler.onDirectDamage(buff, caster, damage); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandlerTest.java index e9ecb0b50..c7906a920 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/HealOrMultiplyDamageHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.ReflectedDamage; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -97,7 +97,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -116,7 +116,7 @@ void onDamageWithMultiplyEffect() { Mockito.when(returnEffect.max()).thenReturn(1); Mockito.when(returnEffect.special()).thenReturn(100); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -133,7 +133,7 @@ void onDamageWithHealEffect() { Mockito.when(returnEffect.max()).thenReturn(1); Mockito.when(returnEffect.special()).thenReturn(0); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -150,7 +150,7 @@ void onReflectedDamageWithMultiplyEffect() { Mockito.when(returnEffect.max()).thenReturn(1); Mockito.when(returnEffect.special()).thenReturn(100); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); ReflectedDamage damage = new ReflectedDamage(new Damage(20, Element.NEUTRAL).reflect(10), caster); @@ -167,7 +167,7 @@ void onReflectedDamageWithHealEffect() { Mockito.when(returnEffect.max()).thenReturn(1); Mockito.when(returnEffect.special()).thenReturn(0); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); ReflectedDamage damage = new ReflectedDamage(new Damage(20, Element.NEUTRAL).reflect(10), caster); @@ -184,7 +184,7 @@ void onDamageWithRandom() { Mockito.when(returnEffect.max()).thenReturn(1); Mockito.when(returnEffect.special()).thenReturn(80); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); int healCount = 0; int damageCount = 0; diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandlerTest.java index bfb0f4345..8c2f9f70c 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReduceDamageHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -97,7 +97,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -114,7 +114,7 @@ void onDirectDamageWillReduce() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -132,7 +132,7 @@ void onDirectDamageWithNegativeStatsWillNotReduce() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -148,7 +148,7 @@ void onDirectDamageWillUseDamageElementCharacteristicAndIntelligence() { Mockito.when(returnEffect.min()).thenReturn(10); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); Damage damage = new Damage(20, Element.NEUTRAL); handler.onDirectDamage(buff, caster, damage); @@ -176,7 +176,7 @@ void onDirectDamageWillIgnoreUnsupportedElement() { Mockito.when(returnEffect.min()).thenReturn(10); Mockito.when(returnEffect.special()).thenReturn(8); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); Damage damage = new Damage(20, Element.NEUTRAL); handler.onDirectDamage(buff, caster, damage); @@ -194,7 +194,7 @@ void onIndirectDamageShouldBeIgnored() { Mockito.when(returnEffect.min()).thenReturn(10); Mockito.when(returnEffect.special()).thenReturn(8); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); Damage damage = new Damage(20, Element.AIR); handler.onIndirectDamage(buff, caster, damage); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandlerTest.java index 188a373af..e6ae35896 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/ReflectDamageHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -97,7 +97,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -114,7 +114,7 @@ void onDirectDamageWillAddReflected() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -130,7 +130,7 @@ void onDirectDamageShouldIgnoreSelfDamage() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -146,7 +146,7 @@ void ignoreOnDamage() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); @@ -164,7 +164,7 @@ void onDirectDamageShouldBeBoostedByWisdom() { Mockito.when(returnEffect.min()).thenReturn(7); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); Damage damage = new Damage(20, Element.NEUTRAL); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandlerTest.java index 80c4ca55d..b72e1b880 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/armor/SpellReturnHandlerTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -96,7 +96,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -123,7 +123,7 @@ void onCastTargetWillIgnoreSelfDamage() { SpellEffect returnEffect = Mockito.mock(SpellEffect.class); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), caster, caster, handler); assertTrue(handler.onCastTarget(buff, scope)); @@ -148,7 +148,7 @@ void onCastTargetWillIgnorePoisonEffects() { SpellEffect returnEffect = Mockito.mock(SpellEffect.class); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertTrue(handler.onCastTarget(buff, scope)); @@ -173,7 +173,7 @@ void onCastTargetWillIgnoreNotDamageNorLooseApEffect() { SpellEffect returnEffect = Mockito.mock(SpellEffect.class); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertTrue(handler.onCastTarget(buff, scope)); @@ -200,7 +200,7 @@ void onCastTargetWillFailedTooHighLevelSpell() { Mockito.when(returnEffect.max()).thenReturn(5); Mockito.when(returnEffect.special()).thenReturn(100); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertTrue(handler.onCastTarget(buff, scope)); @@ -227,7 +227,7 @@ void onCastTargetWillFailedTooLowProbability() { Mockito.when(returnEffect.max()).thenReturn(5); Mockito.when(returnEffect.special()).thenReturn(0); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertTrue(handler.onCastTarget(buff, scope)); @@ -254,7 +254,7 @@ void onCastTargetWillReturnDamageSpell() { Mockito.when(returnEffect.max()).thenReturn(6); Mockito.when(returnEffect.special()).thenReturn(100); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertFalse(handler.onCastTarget(buff, scope)); @@ -282,7 +282,7 @@ void onCastTargetWillReturnApLooseSpell() { Mockito.when(returnEffect.max()).thenReturn(6); Mockito.when(returnEffect.special()).thenReturn(100); - Buff buff = new Buff(returnEffect, Mockito.mock(Spell.class), target, target, handler); + FightBuff buff = new FightBuff(returnEffect, Mockito.mock(Spell.class), target, target, handler); assertFalse(handler.onCastTarget(buff, scope)); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandlerTest.java index b3b14f550..cc420f20a 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddActionPointsHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -106,8 +106,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 111).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -121,9 +121,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -157,9 +157,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(5, buff.get().effect().min()); @@ -176,7 +176,7 @@ void onBuffStartedAndTerminatedOnTarget() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -195,7 +195,7 @@ void onBuffStartedAndTerminatedOnCaster() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, caster, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicHandlerTest.java index b0c4501a5..c7374f6fa 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -34,16 +34,13 @@ import fr.quatrevieux.araknemu.game.spell.effect.area.CellArea; import fr.quatrevieux.araknemu.game.spell.effect.area.CircleArea; import fr.quatrevieux.araknemu.game.spell.effect.target.SpellEffectTarget; -import fr.quatrevieux.araknemu.game.world.creature.Life; import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -92,7 +89,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -118,8 +115,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -135,9 +132,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -164,9 +161,9 @@ public void onCharacteristicAltered(Buff buff, Characteristic characteristic, in @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -187,8 +184,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -205,7 +202,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -231,9 +228,9 @@ void applyFromHook() { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, handler)); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, handler)); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); assertBetween(50, 60, buff.effect().min()); assertEquals(0,buff.effect().max()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandlerTest.java index 29e81c4ea..d388be424 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddCharacteristicOnDamageHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -115,8 +115,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 788).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 788).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 788).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 788).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -132,9 +132,9 @@ void functionalOnDamage() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -161,7 +161,7 @@ public void onCharacteristicAltered(Buff buff, Characteristic characteristic, in new DamageApplier(Element.FIRE, fight).applyFixed(caster, 10, target); - Buff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); + FightBuff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); assertEquals(10, characBuff.effect().min()); assertEquals(3, characBuff.effect().duration()); @@ -229,7 +229,7 @@ void functionalCharacteristicBoostDependOnFirstSpellEffectParameter() { new DamageApplier(Element.FIRE, fight).applyFixed(caster, 10, target); - Buff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 138).findFirst().get(); + FightBuff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 138).findFirst().get(); assertEquals(10, characBuff.effect().min()); assertEquals(3, characBuff.effect().duration()); @@ -264,7 +264,7 @@ void functionalDamageHigherThanMaximumBuff() { new DamageApplier(Element.FIRE, fight).applyFixed(caster, 100, target); - Buff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); + FightBuff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); assertEquals(50, characBuff.effect().min()); assertEquals(3, characBuff.effect().duration()); @@ -304,7 +304,7 @@ void functionalShouldBeLimitedByMaximum() { new DamageApplier(Element.FIRE, fight).applyFixed(caster, 30, target); - Buff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); + FightBuff characBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); assertEquals(30, characBuff.effect().min()); assertEquals(3, characBuff.effect().duration()); @@ -379,7 +379,7 @@ void functionalOnSelfDamage() { new DamageApplier(Element.FIRE, fight).applyFixed(caster, 30, caster); - Buff characBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); + FightBuff characBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst().get(); assertEquals(30, characBuff.effect().min()); assertEquals(4, characBuff.remainingTurns()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandlerTest.java index eecc7aa1f..d307a0ed9 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddMovementPointsHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -106,8 +106,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 128).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -121,9 +121,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -157,9 +157,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(5, buff.get().effect().min()); @@ -176,7 +176,7 @@ void onBuffStartedAndTerminatedOnTarget() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -195,7 +195,7 @@ void onBuffStartedAndTerminatedOnCaster() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, caster, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandlerTest.java index 91f83ffda..8c671ae3a 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddNotDispellableCharacteristicHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -89,7 +89,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -115,8 +115,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -132,9 +132,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -168,9 +168,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(50, buff.get().effect().min()); @@ -181,9 +181,9 @@ void applyFromHook() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -204,8 +204,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -222,7 +222,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityHandlerTest.java index e3fdf94f8..a08646ef8 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -89,7 +89,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -115,8 +115,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -132,9 +132,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -168,9 +168,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(50, buff.get().effect().min()); @@ -182,9 +182,9 @@ void applyFromHook() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -205,8 +205,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -224,7 +224,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityNotDispellableHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityNotDispellableHandlerTest.java index b6883060f..8cd2aa2dc 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityNotDispellableHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AddVitalityNotDispellableHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -90,7 +90,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -116,8 +116,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -133,9 +133,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -169,9 +169,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(50, buff.get().effect().min()); @@ -183,9 +183,9 @@ void applyFromHook() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -206,8 +206,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -225,7 +225,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHookTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHookTest.java index 5316a1d9b..b6e27eb91 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHookTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterCharacteristicHookTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -67,7 +67,7 @@ void add() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 50), spell, caster, target, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 50), spell, caster, target, hook); target.buffs().add(buff); assertEquals(50, target.characteristics().get(Characteristic.STRENGTH)); @@ -89,7 +89,7 @@ void remove() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 50), spell, caster, target, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 50), spell, caster, target, hook); target.buffs().add(buff); assertEquals(-50, target.characteristics().get(Characteristic.STRENGTH)); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHookTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHookTest.java index fe90e1d95..802601926 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHookTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/AlterVitalityHookTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; @@ -67,7 +67,7 @@ void add() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, hook); hook.onBuffStarted(buff); requestStack.assertAll( @@ -96,7 +96,7 @@ void remove() { Mockito.when(effect.min()).thenReturn(20); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, hook); hook.onBuffStarted(buff); requestStack.assertAll( diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandlerTest.java index 0a46eb3ae..13fb8f381 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/BoostCasterSightHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -104,8 +104,8 @@ void buffShouldOnlyTargetCaster() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertFalse(buff2.isPresent()); @@ -116,9 +116,9 @@ void buffShouldOnlyTargetCaster() { @Test void buffMaximized() { - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -139,8 +139,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertFalse(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandlerTest.java index 675d9bf14..af3c16b32 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/DecreaseCasterSightHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -104,8 +104,8 @@ void buffShouldOnlyTargetCaster() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertFalse(buff2.isPresent()); @@ -116,9 +116,9 @@ void buffShouldOnlyTargetCaster() { @Test void buffMaximized() { - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -139,8 +139,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertFalse(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandlerTest.java index 18e309a69..59b783e36 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveActionPointsHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -106,8 +106,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 168).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -121,9 +121,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -157,9 +157,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(5, buff.get().effect().min()); @@ -176,7 +176,7 @@ void onBuffStartedAndTerminatedOnTarget() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -195,7 +195,7 @@ void onBuffStartedAndTerminatedOnCaster() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, caster, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveCharacteristicHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveCharacteristicHandlerTest.java index 03cde8792..84e6e73f4 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveCharacteristicHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveCharacteristicHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -88,7 +88,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -114,8 +114,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -129,9 +129,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -164,7 +164,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -190,9 +190,9 @@ void applyFromHook() { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, handler)); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, handler)); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 123).findFirst().get(); assertBetween(50, 60, buff.effect().min()); assertEquals(0,buff.effect().max()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandlerTest.java index d03b204f0..5d869939c 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveMovementPointsHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -106,8 +106,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 169).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -121,9 +121,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -157,9 +157,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(2); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(2, buff.get().effect().min()); @@ -176,7 +176,7 @@ void onBuffStartedAndTerminatedOnTarget() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); @@ -195,7 +195,7 @@ void onBuffStartedAndTerminatedOnCaster() { Mockito.when(effect.min()).thenReturn(3); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, caster, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, caster, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveVitalityHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveVitalityHandlerTest.java index 061dbbc87..652897338 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveVitalityHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/RemoveVitalityHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -89,7 +89,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertBetween(50, 60, buff1.get().effect().min()); @@ -115,8 +115,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -132,9 +132,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - caster.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + caster.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -168,9 +168,9 @@ void applyFromHook() { Mockito.when(effect.min()).thenReturn(20); Mockito.when(effect.duration()).thenReturn(5); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buff.isPresent()); assertEquals(20, buff.get().effect().min()); @@ -182,9 +182,9 @@ void applyFromHook() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -205,8 +205,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -224,7 +224,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandlerTest.java index 5325b3f39..a7994fb86 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealCharacteristicHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -108,8 +108,8 @@ void buffSingleTarget() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); assertTrue(casterBuff.isPresent()); assertTrue(targetBuff.isPresent()); @@ -139,9 +139,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -168,9 +168,9 @@ public void onCharacteristicAltered(Buff buff, Characteristic characteristic, in @Test void buffSingleTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -193,8 +193,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 152).findFirst(); assertTrue(casterBuff.isPresent()); assertTrue(targetBuff.isPresent()); @@ -237,7 +237,7 @@ void buffNotTargetShouldDoNothing() { FightCastScope scope = makeCastScope(caster, spell, effect, fight.map().get(15)); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertFalse(casterBuff.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealVitalityHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealVitalityHandlerTest.java index d480d9ce3..441fb3807 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealVitalityHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/StealVitalityHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -108,8 +108,8 @@ void buffSingleTarget() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); - Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); + Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); assertTrue(casterBuff.isPresent()); assertTrue(targetBuff.isPresent()); @@ -145,9 +145,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -191,8 +191,8 @@ void buffShouldKillTargetIfEffectIsHigherThatItsLife() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); - Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); + Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); assertTrue(casterBuff.isPresent()); assertTrue(targetBuff.isPresent()); @@ -213,9 +213,9 @@ void buffShouldKillTargetIfEffectIsHigherThatItsLife() { @Test void buffSingleTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -238,8 +238,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); - Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); + Optional targetBuff = target.buffs().stream().filter(buff -> buff.effect().effect() == 153).findFirst(); assertTrue(casterBuff.isPresent()); assertTrue(targetBuff.isPresent()); @@ -288,7 +288,7 @@ void buffNoTargetShouldDoNothing() { FightCastScope scope = makeCastScope(caster, spell, effect, fight.map().get(15)); handler.buff(scope, scope.effects().get(0)); - Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); + Optional casterBuff = caster.buffs().stream().filter(buff -> buff.effect().effect() == 125).findFirst(); assertFalse(casterBuff.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostApplierTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostApplierTest.java index f1c4293db..b44534025 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostApplierTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostApplierTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -168,7 +168,7 @@ void applyNotDodged() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); applier.apply(scope, target, effect); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); assertEquals(4, target.characteristics().get(Characteristic.ACTION_POINT)); assertEquals(2, buff.effect().min()); @@ -200,7 +200,7 @@ void applyOnActiveTurnShouldRemoveAPFromTurn() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); applier.apply(scope, caster, effect); - Buff buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); + FightBuff buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); assertEquals(4, caster.characteristics().get(Characteristic.ACTION_POINT)); assertEquals(4, caster.turn().points().actionPoints()); @@ -258,7 +258,7 @@ void applyPartiallyDodged() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); applier.apply(scope, target, effect); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst().get(); assertEquals(5, target.characteristics().get(Characteristic.ACTION_POINT)); assertEquals(1, buff.effect().min()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostHandlerTest.java index 849b67ecf..563395643 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/ActionPointLostHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -91,7 +91,7 @@ void buffFixed() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff.isPresent()); assertEquals(2, buff.get().effect().min()); @@ -107,9 +107,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -153,7 +153,7 @@ void directEffectShouldBeTransformedToSingleTurnBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff.isPresent()); assertEquals(2, buff.get().effect().min()); @@ -183,7 +183,7 @@ void applyOnSelfShouldRemovePointsFromCurrentTurn() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff.isPresent()); assertEquals(1, buff.get().effect().min()); @@ -215,7 +215,7 @@ void dodgedAllShouldNotAddBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertFalse(buff.isPresent()); assertEquals(6, target.characteristics().get(Characteristic.ACTION_POINT)); @@ -243,7 +243,7 @@ void partialDodge() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff.isPresent()); assertBetween(1, 2, buff.get().effect().min()); @@ -276,8 +276,8 @@ void withArea() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); - Optional buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -306,7 +306,7 @@ void buffStartAndTerminated() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); requestStack.assertAll( ActionEffect.buff(buff.get(), -2), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHookTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHookTest.java index a542b4a3e..ba58fb9ce 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHookTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/AlterPointHookTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffEffect; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -67,7 +67,7 @@ void addActionPoint() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); caster.buffs().add(buff); assertEquals(8, caster.characteristics().get(Characteristic.ACTION_POINT)); @@ -91,7 +91,7 @@ void removeActionPoint() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); caster.buffs().add(buff); assertEquals(4, caster.characteristics().get(Characteristic.ACTION_POINT)); @@ -115,7 +115,7 @@ void addMovementPoint() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); caster.buffs().add(buff); assertEquals(5, caster.characteristics().get(Characteristic.MOVEMENT_POINT)); @@ -139,7 +139,7 @@ void removeMovementPoint() { Mockito.when(effect.min()).thenReturn(5); Mockito.when(effect.duration()).thenReturn(1); - Buff buff = new Buff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); + FightBuff buff = new FightBuff(BuffEffect.fixed(effect, 2), spell, caster, caster, hook); caster.buffs().add(buff); assertEquals(1, caster.characteristics().get(Characteristic.MOVEMENT_POINT)); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostApplierTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostApplierTest.java index 144314fa4..617d69dc6 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostApplierTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostApplierTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -168,7 +168,7 @@ void applyNotDodged() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); applier.apply(scope, target, effect); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); assertEquals(1, target.characteristics().get(Characteristic.MOVEMENT_POINT)); assertEquals(2, buff.effect().min()); @@ -200,7 +200,7 @@ void applyOnActiveTurnShouldRemoveAPFromTurn() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); applier.apply(scope, caster, effect); - Buff buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); + FightBuff buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); assertEquals(1, caster.characteristics().get(Characteristic.MOVEMENT_POINT)); assertEquals(1, caster.turn().points().movementPoints()); @@ -258,7 +258,7 @@ void applyPartiallyDodged() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); applier.apply(scope, target, effect); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst().get(); assertEquals(2, target.characteristics().get(Characteristic.MOVEMENT_POINT)); assertEquals(1, buff.effect().min()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostHandlerTest.java index 4d3450df4..6512fc6a6 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/MovementPointLostHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -91,7 +91,7 @@ void buffFixed() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff.isPresent()); assertEquals(2, buff.get().effect().min()); @@ -107,9 +107,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -153,7 +153,7 @@ void directEffectShouldBeTransformedToSingleTurnBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff.isPresent()); assertEquals(2, buff.get().effect().min()); @@ -183,7 +183,7 @@ void applyOnSelfShouldRemovePointsFromCurrentTurn() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff.isPresent()); assertEquals(1, buff.get().effect().min()); @@ -215,7 +215,7 @@ void dodgedAllShouldNotAddBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertFalse(buff.isPresent()); assertEquals(3, target.characteristics().get(Characteristic.MOVEMENT_POINT)); @@ -243,7 +243,7 @@ void partialDodge() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff.isPresent()); assertBetween(1, 2, buff.get().effect().min()); @@ -276,8 +276,8 @@ void withArea() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); - Optional buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -306,7 +306,7 @@ void buffStartAndTerminated() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); requestStack.assertAll( ActionEffect.buff(buff.get(), -2), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealActionPointHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealActionPointHandlerTest.java index 2cda88b11..511564a49 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealActionPointHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealActionPointHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -93,8 +93,8 @@ void buffFixed() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buffT.isPresent()); assertTrue(buffC.isPresent()); @@ -133,8 +133,8 @@ void directEffectShouldBeTransformedToSingleTurnBuffForTargetAndAddTurnPointToCa handler.handle(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buffT.isPresent()); assertFalse(buffC.isPresent()); @@ -157,9 +157,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -203,7 +203,7 @@ void applyOnSelfShouldBeIgnored() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertFalse(buff.isPresent()); requestStack.assertEmpty(); @@ -259,8 +259,8 @@ void partialDodge() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); assertTrue(buffT.isPresent()); assertTrue(buffC.isPresent()); @@ -307,9 +307,9 @@ void withArea() { FightCastScope scope = makeCastScope(getFighter(0), spell, effect, fight.map().get(150)); handler.buff(scope, scope.effects().get(0)); - Optional buff0 = getFighter(0).buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); - Optional buff1 = getFighter(1).buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); - Optional buff2 = getFighter(2).buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff0 = getFighter(0).buffs().stream().filter(b -> b.effect().effect() == 111).findFirst(); + Optional buff1 = getFighter(1).buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); + Optional buff2 = getFighter(2).buffs().stream().filter(b -> b.effect().effect() == 101).findFirst(); assertTrue(buff0.isPresent()); assertTrue(buff1.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealMovementPointHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealMovementPointHandlerTest.java index 56a30d2ce..a884f324f 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealMovementPointHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/characteristic/point/StealMovementPointHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -93,8 +93,8 @@ void buffFixed() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); assertTrue(buffT.isPresent()); assertTrue(buffC.isPresent()); @@ -119,9 +119,9 @@ void buffShouldCallOnCharacteristicAltered() { AtomicReference hookCharacteristic = new AtomicReference<>(); AtomicReference hookValue = new AtomicReference<>(); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onCharacteristicAltered(Buff buff, Characteristic characteristic, int value) { + public void onCharacteristicAltered(FightBuff buff, Characteristic characteristic, int value) { hookCharacteristic.set(characteristic); hookValue.set(value); } @@ -166,8 +166,8 @@ void directEffectShouldBeTransformedToSingleTurnBuffForTargetAndAddTurnPointToCa handler.handle(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); assertTrue(buffT.isPresent()); assertFalse(buffC.isPresent()); @@ -203,7 +203,7 @@ void applyOnSelfShouldBeIgnored() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff = caster.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertFalse(buff.isPresent()); requestStack.assertEmpty(); @@ -259,8 +259,8 @@ void partialDodge() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); - Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); + Optional buffT = target.buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buffC = caster.buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); assertTrue(buffT.isPresent()); assertTrue(buffC.isPresent()); @@ -307,9 +307,9 @@ void withArea() { FightCastScope scope = makeCastScope(getFighter(0), spell, effect, fight.map().get(150)); handler.buff(scope, scope.effects().get(0)); - Optional buff0 = getFighter(0).buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); - Optional buff1 = getFighter(1).buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); - Optional buff2 = getFighter(2).buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff0 = getFighter(0).buffs().stream().filter(b -> b.effect().effect() == 128).findFirst(); + Optional buff1 = getFighter(1).buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); + Optional buff2 = getFighter(2).buffs().stream().filter(b -> b.effect().effect() == 127).findFirst(); assertTrue(buff0.isPresent()); assertTrue(buff1.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplierTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplierTest.java index d21889ada..0d882e9ed 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplierTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageApplierTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.FighterData; @@ -243,9 +243,9 @@ void applyWithReduceBuff() { DamageApplier applier = new DamageApplier(Element.AIR, fight); target.buffs().add( - new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onDamage(Buff buff, Damage value) { + public void onDamage(FightBuff buff, Damage value) { value.reduce(7); } }) @@ -269,9 +269,9 @@ void applyWithReduceBuffShouldBeIgnoredForErosion() { target.life().alterErosion(10); target.buffs().add( - new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onDamage(Buff buff, Damage value) { + public void onDamage(FightBuff buff, Damage value) { value.reduce(80); } }) @@ -313,32 +313,32 @@ void applyDirectDamageShouldCallBuffHook() { DamageApplier applier = new DamageApplier(Element.AIR, fight); - AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); AtomicReference calledCaster = new AtomicReference<>(); AtomicReference calledDamage = new AtomicReference<>(); - AtomicReference appliedDamageBuff = new AtomicReference<>(); + AtomicReference appliedDamageBuff = new AtomicReference<>(); AtomicReference appliedDamageCaster = new AtomicReference<>(); AtomicInteger appliedDamageValue = new AtomicInteger(); AtomicInteger appliedElementDamageValue = new AtomicInteger(); AtomicReference appliedElementDamageElement = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { calledBuff.set(buff); calledCaster.set(caster); calledDamage.set(value); } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { appliedDamageBuff.set(buff); appliedDamageCaster.set(caster); appliedDamageValue.set(damage); } @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { appliedElementDamageValue.set(value); appliedElementDamageElement.set(element); } @@ -370,28 +370,28 @@ void applyBuffDamageShouldCallBuffHook() { DamageApplier applier = new DamageApplier(Element.AIR, fight); - AtomicReference calledBuff = new AtomicReference<>(); - AtomicReference calledPoison = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledPoison = new AtomicReference<>(); AtomicReference calledDamage = new AtomicReference<>(); AtomicBoolean appliedDamageHookCalled = new AtomicBoolean(); AtomicInteger appliedElementDamageValue = new AtomicInteger(); AtomicReference appliedElementDamageElement = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onBuffDamage(Buff buff, Buff poison, Damage value) { + public void onBuffDamage(FightBuff buff, FightBuff poison, Damage value) { calledBuff.set(buff); calledPoison.set(poison); calledDamage.set(value); } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { appliedDamageHookCalled.set(true); } @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { appliedElementDamageValue.set(value); appliedElementDamageElement.set(element); } @@ -399,7 +399,7 @@ public void onElementDamageApplied(Buff buff, Element element, @NonNegative int target.buffs().add(buff); - Buff toApply = new Buff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.apply(toApply); assertEquals(-10, value); @@ -424,7 +424,7 @@ void applyBuffWithErosion() { DamageApplier applier = new DamageApplier(Element.AIR, fight); - Buff toApply = new Buff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.apply(toApply); assertEquals(-30, value); @@ -436,12 +436,12 @@ void applyWithCounterDamageCharacteristic() { target.characteristics().alter(Characteristic.COUNTER_DAMAGE, 5); SpellEffect effect = Mockito.mock(SpellEffect.class); - AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); AtomicReference calledReflectedDamage = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { calledBuff.set(buff); calledReflectedDamage.set(damage); } @@ -523,9 +523,9 @@ void applyWithCounterDamageChangeTarget() throws SQLException { target.characteristics().alter(Characteristic.COUNTER_DAMAGE, 5); SpellEffect effect = Mockito.mock(SpellEffect.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, new BuffHook() { @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { damage.changeTarget(newTarget); } }); @@ -574,7 +574,7 @@ void applyWithCounterDamageNoDamageShouldBeIgnored() { SpellEffect effect = Mockito.mock(SpellEffect.class); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); @@ -600,9 +600,9 @@ void applyWithCounterDamageAndNegativeMultiplierShouldHealTarget() { caster.life().damage(caster, 10); SpellEffect effect = Mockito.mock(SpellEffect.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { damage.multiply(-1); } }); @@ -632,14 +632,14 @@ void applyWithNegativeMultiplierShouldHealTargetAndNotCallDirectDamageAppliedHoo AtomicBoolean appliedDamageHookCalled = new AtomicBoolean(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { value.multiply(-1); } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { appliedDamageHookCalled.set(true); } }); @@ -662,32 +662,32 @@ public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damag void applyFixedBase() { DamageApplier applier = new DamageApplier(Element.EARTH, fight); - AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); AtomicReference calledCaster = new AtomicReference<>(); AtomicReference calledDamage = new AtomicReference<>(); - AtomicReference appliedDamageBuff = new AtomicReference<>(); + AtomicReference appliedDamageBuff = new AtomicReference<>(); AtomicReference appliedDamageCaster = new AtomicReference<>(); AtomicInteger appliedDamageValue = new AtomicInteger(); AtomicInteger appliedElementDamageValue = new AtomicInteger(); AtomicReference appliedElementDamageElement = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onDirectDamage(Buff buff, Fighter caster, Damage value) { + public void onDirectDamage(FightBuff buff, Fighter caster, Damage value) { calledBuff.set(buff); calledCaster.set(caster); calledDamage.set(value); } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { appliedDamageBuff.set(buff); appliedDamageCaster.set(caster); appliedDamageValue.set(damage); } @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { appliedElementDamageValue.set(value); appliedElementDamageElement.set(element); } @@ -750,12 +750,12 @@ void applyFixedWithCounterDamageCharacteristic() { target.characteristics().alter(Characteristic.COUNTER_DAMAGE, 5); SpellEffect effect = Mockito.mock(SpellEffect.class); - AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); AtomicReference calledReflectedDamage = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onReflectedDamage(Buff buff, ReflectedDamage damage) { + public void onReflectedDamage(FightBuff buff, ReflectedDamage damage) { calledBuff.set(buff); calledReflectedDamage.set(damage); } @@ -803,28 +803,28 @@ void applyFixedWithResistance() { void applyIndirectFixedBase() { DamageApplier applier = new DamageApplier(Element.EARTH, fight); - AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); AtomicReference calledCaster = new AtomicReference<>(); AtomicReference calledDamage = new AtomicReference<>(); AtomicBoolean appliedDamageHookCalled = new AtomicBoolean(); AtomicInteger appliedElementDamageValue = new AtomicInteger(); AtomicReference appliedElementDamageElement = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onIndirectDamage(Buff buff, Fighter caster, Damage value) { + public void onIndirectDamage(FightBuff buff, Fighter caster, Damage value) { calledBuff.set(buff); calledCaster.set(caster); calledDamage.set(value); } @Override - public void onDirectDamageApplied(Buff buff, Fighter caster, @Positive int damage) { + public void onDirectDamageApplied(FightBuff buff, Fighter caster, @Positive int damage) { appliedDamageHookCalled.set(true); } @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { appliedElementDamageValue.set(value); appliedElementDamageElement.set(element); } @@ -872,7 +872,7 @@ void applyIndirectFixedWithCounterDamageCharacteristicShouldBeIgnored() { SpellEffect effect = Mockito.mock(SpellEffect.class); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); @@ -912,22 +912,22 @@ void applyIndirectFixedWithResistance() { void applyFixedBuffDamage() { DamageApplier applier = new DamageApplier(Element.AIR, fight); - AtomicReference calledBuff = new AtomicReference<>(); - AtomicReference calledPoison = new AtomicReference<>(); + AtomicReference calledBuff = new AtomicReference<>(); + AtomicReference calledPoison = new AtomicReference<>(); AtomicReference calledDamage = new AtomicReference<>(); AtomicInteger appliedElementDamageValue = new AtomicInteger(); AtomicReference appliedElementDamageElement = new AtomicReference<>(); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onBuffDamage(Buff buff, Buff poison, Damage value) { + public void onBuffDamage(FightBuff buff, FightBuff poison, Damage value) { calledBuff.set(buff); calledPoison.set(poison); calledDamage.set(value); } @Override - public void onElementDamageApplied(Buff buff, Element element, @NonNegative int value) { + public void onElementDamageApplied(FightBuff buff, Element element, @NonNegative int value) { appliedElementDamageValue.set(value); appliedElementDamageElement.set(element); } @@ -935,7 +935,7 @@ public void onElementDamageApplied(Buff buff, Element element, @NonNegative int target.buffs().add(buff); - Buff toApply = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.applyFixed(toApply, 10); assertEquals(-10, value); @@ -956,7 +956,7 @@ void applyFixedBuffDamageWithResistance() { DamageApplier applier = new DamageApplier(Element.AIR, fight); - Buff toApply = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.applyFixed(toApply, 10); assertEquals(-2, value); @@ -972,7 +972,7 @@ void applyShouldCallOnCastDamageOnCaster() { DamageApplier applier = new DamageApplier(Element.AIR, fight); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); @@ -988,7 +988,7 @@ void applyFixedShouldCallOnCastDamageOnCaster() { DamageApplier applier = new DamageApplier(Element.AIR, fight); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); @@ -1004,13 +1004,13 @@ void applyBuffShouldCallOnCastDamageOnCaster() { DamageApplier applier = new DamageApplier(Element.AIR, fight); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); SpellEffect effect = Mockito.mock(SpellEffect.class); Mockito.when(effect.min()).thenReturn(10); - Buff toApply = new Buff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.apply(toApply); @@ -1024,11 +1024,11 @@ void applyFixedBuffShouldCallOnCastDamageOnCaster() { DamageApplier applier = new DamageApplier(Element.AIR, fight); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); caster.buffs().add(buff); - Buff toApply = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); + FightBuff toApply = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, Mockito.mock(BuffHook.class)); int value = applier.applyFixed(toApply, 10); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandlerTest.java index 3ba937d93..219b4a4db 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -325,7 +325,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -362,7 +362,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.max()).thenReturn(15); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); int damage = target.life().max() - target.life().current(); @@ -377,7 +377,7 @@ void onStartTurnOnDie() { Mockito.when(effect.min()).thenReturn(100000); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); } @Test @@ -393,7 +393,7 @@ void applyFromHook() { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); int damage = target.life().max() - target.life().current(); @@ -406,9 +406,9 @@ void applyFromHook() { void applyFromHookShouldApplyIndirectDamage() { AtomicBoolean called = new AtomicBoolean(false); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { @Override - public void onIndirectDamage(Buff buff, Fighter caster, Damage value) { + public void onIndirectDamage(FightBuff buff, Fighter caster, Damage value) { called.set(true); } })); @@ -424,7 +424,7 @@ public void onIndirectDamage(Buff buff, Fighter caster, Damage value) { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); assertBetween(10, 15, target.life().max() - target.life().current()); assertTrue(called.get()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandlerTest.java index 827ca5d42..a1096aeb3 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/DamageOnActionPointUseHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -101,7 +101,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedCasterDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedCasterDamageHandlerTest.java index 11e379a0d..d21dcd4a0 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedCasterDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedCasterDamageHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -115,7 +115,7 @@ void applyFixedEffect() { @Test void applyShouldNotCallBuffHooks() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, caster, hook); caster.buffs().add(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandlerTest.java index 19c59af5d..5493f0b4e 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedDamageHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -116,7 +116,7 @@ void applyFixedEffect() { @Test void applyShouldNotCallBuffHooks() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); target.buffs().add(buff); @@ -258,7 +258,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -295,7 +295,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.max()).thenReturn(15); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); int damage = target.life().max() - target.life().current(); @@ -310,6 +310,6 @@ void onStartTurnOnDie() { Mockito.when(effect.min()).thenReturn(100000); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); } } diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedStealLifeHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedStealLifeHandlerTest.java index e288a42f5..17b0d588f 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedStealLifeHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/FixedStealLifeHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -124,7 +124,7 @@ void applyFixedEffect() { @Test void applyShouldNotCallBuffHooks() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, hook); target.buffs().add(buff); requestStack.clear(); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/IndirectPercentLifeDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/IndirectPercentLifeDamageHandlerTest.java index 6533a9df7..51bfcc2ee 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/IndirectPercentLifeDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/IndirectPercentLifeDamageHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -292,7 +292,7 @@ void applyShouldCallIndirectBuffHook() { Mockito.when(constraints.freeCell()).thenReturn(false); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, hook); target.buffs().add(buff); FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandlerTest.java index a63bc1494..1aa388fcd 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/PercentLifeDamageHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -297,7 +297,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -334,7 +334,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.max()).thenReturn(15); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); int damage = target.life().max() - target.life().current(); @@ -349,7 +349,7 @@ void onStartTurnOnDie() { Mockito.when(effect.min()).thenReturn(100000); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); } @Test @@ -365,7 +365,7 @@ void applyFromHook() { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); int damage = target.life().max() - target.life().current(); @@ -378,9 +378,9 @@ void applyFromHook() { void applyFromHookShouldApplyIndirectDamage() { AtomicBoolean called = new AtomicBoolean(false); - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { @Override - public void onIndirectDamage(Buff buff, Fighter caster, Damage value) { + public void onIndirectDamage(FightBuff buff, Fighter caster, Damage value) { called.set(true); } })); @@ -396,7 +396,7 @@ public void onIndirectDamage(Buff buff, Fighter caster, Damage value) { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); assertBetween(29, 44, target.life().max() - target.life().current()); assertTrue(called.get()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandlerTest.java index e15b8b639..9cb0de3a0 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/damage/StealLifeHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -332,7 +332,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -368,7 +368,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); assertEquals(10, target.life().max() - target.life().current()); assertEquals(5, caster.life().current() - baseLife); @@ -385,6 +385,6 @@ void onStartTurnOnDie() { Mockito.when(effect.min()).thenReturn(10000); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); } } diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandlerTest.java index f311c6ec7..e87d0aea3 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/FixedHealHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -204,7 +204,7 @@ void applyFromHook() { Mockito.when(effect.duration()).thenReturn(5); Mockito.when(spell.constraints()).thenReturn(Mockito.mock(SpellConstraints.class)); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); requestStack.assertAll(ActionEffect.alterLifePoints(caster, target, 10)); assertEquals(10, computeHeal()); @@ -226,7 +226,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -263,7 +263,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.max()).thenReturn(15); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); assertBetween(10, 15, computeHeal()); @@ -277,15 +277,15 @@ void onStartTurnKillByHookShouldReturnFalse() { Mockito.when(effect.min()).thenReturn(10); // Kill on heal - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { @Override - public void onLifeAltered(Buff buff, int value) { + public void onLifeAltered(FightBuff buff, int value) { buff.target().life().kill(buff.caster()); } })); requestStack.clear(); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); assertTrue(target.dead()); requestStack.assertAll( diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/GivePercentLifeHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/GivePercentLifeHandlerTest.java index e72d654a7..d4f4731e5 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/GivePercentLifeHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/GivePercentLifeHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -226,7 +226,7 @@ void applyFromHook() { Mockito.when(effect.duration()).thenReturn(5); Mockito.when(spell.constraints()).thenReturn(Mockito.mock(SpellConstraints.class)); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); requestStack.assertAll( ActionEffect.alterLifePoints(caster, caster, -29), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandlerTest.java index e37a57326..e3c568761 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -206,7 +206,7 @@ void applyFromHook() { Mockito.when(effect.duration()).thenReturn(5); Mockito.when(spell.constraints()).thenReturn(Mockito.mock(SpellConstraints.class)); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); requestStack.assertAll(ActionEffect.alterLifePoints(caster, target, 10)); assertEquals(10, computeHeal()); @@ -228,7 +228,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -265,7 +265,7 @@ void onStartTurn() { Mockito.when(effect.min()).thenReturn(10); Mockito.when(effect.max()).thenReturn(15); - assertTrue(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertTrue(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); assertBetween(10, 15, computeHeal()); @@ -279,15 +279,15 @@ void onStartTurnKillByHookShouldReturnFalse() { Mockito.when(effect.min()).thenReturn(10); // Kill on heal - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), caster, target, new BuffHook() { @Override - public void onLifeAltered(Buff buff, int value) { + public void onLifeAltered(FightBuff buff, int value) { buff.target().life().kill(buff.caster()); } })); requestStack.clear(); - assertFalse(handler.onStartTurn(new Buff(effect, Mockito.mock(Spell.class), caster, target, handler))); + assertFalse(handler.onStartTurn(new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler))); assertTrue(target.dead()); requestStack.assertAll( diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandlerTest.java index 9c4e8154c..fb1d1d0a3 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnAttackHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; @@ -107,7 +107,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -171,9 +171,9 @@ void onDirectDamageTransformedToHealShouldBeIgnored() { Mockito.when(spell.constraints()).thenReturn(constraints); Mockito.when(constraints.freeCell()).thenReturn(false); - target.buffs().add(new Buff(effect, spell, target, target, new BuffHook() { + target.buffs().add(new FightBuff(effect, spell, target, target, new BuffHook() { @Override - public void onDamage(Buff buff, Damage value) { + public void onDamage(FightBuff buff, Damage value) { value.multiply(-1); // Transform damage to heal } })); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandlerTest.java index 122030e32..dc3ab1920 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/heal/HealOnDamageHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -127,7 +127,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandlerTest.java index c06040384..029c408b8 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddDiscernmentHandlerTest.java @@ -19,13 +19,12 @@ package fr.quatrevieux.araknemu.game.fight.castable.effect.handler.misc; -import fr.quatrevieux.araknemu.data.constant.Characteristic; import fr.quatrevieux.araknemu.data.value.EffectArea; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -34,7 +33,6 @@ import fr.quatrevieux.araknemu.game.spell.effect.area.CellArea; import fr.quatrevieux.araknemu.game.spell.effect.area.CircleArea; import fr.quatrevieux.araknemu.game.spell.effect.target.SpellEffectTarget; -import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -106,8 +104,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -120,9 +118,9 @@ void buff() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -143,8 +141,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -161,7 +159,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); handler.onBuffStarted(buff); assertEquals(150, target.characteristics().discernment()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandlerTest.java index 3115c0182..870900748 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/AddErosionHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -102,8 +102,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -116,9 +116,9 @@ void buff() { @Test void buffWithOneTargetMaximized() { - target.buffs().add(new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { + target.buffs().add(new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), target, target, new BuffHook() { @Override - public void onEffectValueTarget(Buff buff, EffectValue value) { + public void onEffectValueTarget(FightBuff buff, EffectValue value) { value.maximize(); } })); @@ -139,8 +139,8 @@ public void onEffectValueTarget(Buff buff, EffectValue value) { FightCastScope scope = makeCastScope(target, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -157,7 +157,7 @@ void onBuffStartedAndTerminated() { Mockito.when(effect.min()).thenReturn(50); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, handler); int maxLife = target.life().max(); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandlerTest.java index b7169dce5..67b27c326 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ApplySpellOnStartTurnHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.fight.module.CommonEffectsModule; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -89,7 +89,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -140,7 +140,7 @@ void handleShouldBeConsideredAsBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.handle(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -169,7 +169,7 @@ void handleOnSelfShouldBeConsideredAsBuff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional found = caster.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = caster.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandlerTest.java index ce8be3680..4fd107e42 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/ChangeAppearanceHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -80,7 +80,7 @@ void applyFromHook() { Mockito.when(effect.duration()).thenReturn(5); Mockito.when(spell.constraints()).thenReturn(Mockito.mock(SpellConstraints.class)); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); requestStack.assertOne(new ActionEffect(149, caster, target.id(), 90, 1234, 1)); } @@ -101,7 +101,7 @@ void buffWillAddBuffToListAndChangeAppearance() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -172,7 +172,7 @@ void handleShouldRemoveCurrentAppearanceWithNegativeEffect() { SpellEffect previousAppearanceEffect = Mockito.mock(SpellEffect.class); Mockito.when(previousAppearanceEffect.special()).thenReturn(1234); - Buff buff = new Buff(previousAppearanceEffect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(previousAppearanceEffect, Mockito.mock(Spell.class), caster, target, handler); target.buffs().add(buff); requestStack.clear(); @@ -197,7 +197,7 @@ void handleShouldDoNothingIfCurrentAppearanceDoNotMatchWithEffect() { SpellEffect previousAppearanceEffect = Mockito.mock(SpellEffect.class); Mockito.when(previousAppearanceEffect.special()).thenReturn(4321); - Buff buff = new Buff(previousAppearanceEffect, Mockito.mock(Spell.class), caster, target, handler); + FightBuff buff = new FightBuff(previousAppearanceEffect, Mockito.mock(Spell.class), caster, target, handler); target.buffs().add(buff); requestStack.clear(); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandlerTest.java index 3e4a0b906..28bd1f41b 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/DispelHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.fight.map.FightCell; @@ -33,7 +33,6 @@ import fr.quatrevieux.araknemu.game.spell.effect.area.CircleArea; import fr.quatrevieux.araknemu.game.spell.effect.target.SpellEffectTarget; import fr.quatrevieux.araknemu.network.game.out.fight.AddBuff; -import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -73,14 +72,14 @@ public void setUp() throws Exception { @Test void handle() { // cannot be debuff - Buff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); + FightBuff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); target.buffs().add(buff_wisdom); FightCastScope scope = makeDebuffSpell(target.cell()); requestStack.clear(); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = target.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); + Optional buff1 = target.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); assertTrue(buff1.isPresent()); requestStack.assertAll( "GA;132;1;2", @@ -91,7 +90,7 @@ void handle() { @Test void applyFromHook() { // can be debuff - Buff toDispel = makeLuckBuffThatcanBeDispelled(); + FightBuff toDispel = makeLuckBuffThatcanBeDispelled(); target.buffs().add(toDispel); requestStack.clear(); @@ -103,7 +102,7 @@ void applyFromHook() { Mockito.when(effect.duration()).thenReturn(5); Mockito.when(spell.constraints()).thenReturn(Mockito.mock(SpellConstraints.class)); - handler.applyFromHook(new Buff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); + handler.applyFromHook(new FightBuff(effect, spell, caster, target, Mockito.mock(BuffHook.class))); requestStack.assertAll("GA;132;1;2"); assertFalse(target.buffs().stream().anyMatch(x -> x.equals(toDispel))); @@ -112,14 +111,14 @@ void applyFromHook() { @Test void buff() { // cannot be debuff - Buff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); + FightBuff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); target.buffs().add(buff_wisdom); FightCastScope scope = makeDebuffSpell(target.cell()); requestStack.clear(); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = target.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); + Optional buff1 = target.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); assertTrue(buff1.isPresent()); requestStack.assertAll( "GA;132;1;2", @@ -130,9 +129,9 @@ void buff() { @Test void notAllBuffsAreRemoved() { // can be debuff - Buff buff_luck = makeLuckBuffThatcanBeDispelled(); + FightBuff buff_luck = makeLuckBuffThatcanBeDispelled(); // cannot be debuff - Buff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); + FightBuff buff_wisdom = makeWisdomBuffThatCannotBeDebuff(); caster.buffs().add(buff_luck); caster.buffs().add(buff_wisdom); @@ -140,8 +139,8 @@ void notAllBuffsAreRemoved() { FightCastScope scope = makeDebuffSpell(caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(x -> x.effect().effect() == 123).findFirst(); - Optional buff2 = caster.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); + Optional buff1 = caster.buffs().stream().filter(x -> x.effect().effect() == 123).findFirst(); + Optional buff2 = caster.buffs().stream().filter(x -> x.effect().effect() == 124).findFirst(); assertFalse(buff1.isPresent()); assertTrue(buff2.isPresent()); @@ -152,14 +151,14 @@ void makeSureOnBuffTerminatedIsCalled() { BuffHook hook = Mockito.mock(BuffHook.class); SpellEffect effect1 = Mockito.mock(SpellEffect.class); - Buff buff1 = new Buff(effect1, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff1 = new FightBuff(effect1, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); caster.buffs().add(buff1); - assertArrayEquals(new Buff[] {buff1}, caster.buffs().stream().toArray()); + assertArrayEquals(new FightBuff[] {buff1}, caster.buffs().stream().toArray()); FightCastScope scope = makeDebuffSpell(caster.cell()); handler.handle(scope, scope.effects().get(0)); - assertArrayEquals(new Buff[] {}, caster.buffs().stream().toArray()); + assertArrayEquals(new FightBuff[] {}, caster.buffs().stream().toArray()); Mockito.verify(hook).onBuffTerminated(buff1); } @@ -177,23 +176,23 @@ private FightCastScope makeDebuffSpell(FightCell cell) { return makeCastScope(caster, spell, debuff, cell); } - private Buff makeLuckBuffThatcanBeDispelled() { + private FightBuff makeLuckBuffThatcanBeDispelled() { SpellEffect effect_luck = Mockito.mock(SpellEffect.class); Mockito.when(effect_luck.effect()).thenReturn(123); Mockito.when(effect_luck.min()).thenReturn(50); Mockito.when(effect_luck.duration()).thenReturn(5); - return new Buff(effect_luck, Mockito.mock(Spell.class), caster, caster, Mockito.mock(BuffHook.class)); + return new FightBuff(effect_luck, Mockito.mock(Spell.class), caster, caster, Mockito.mock(BuffHook.class)); } - private Buff makeWisdomBuffThatCannotBeDebuff() { + private FightBuff makeWisdomBuffThatCannotBeDebuff() { SpellEffect effect_wisdom = Mockito.mock(SpellEffect.class); Mockito.when(effect_wisdom.effect()).thenReturn(124); Mockito.when(effect_wisdom.min()).thenReturn(50); Mockito.when(effect_wisdom.duration()).thenReturn(5); - return new Buff(effect_wisdom, Mockito.mock(Spell.class), caster, caster, Mockito.mock(BuffHook.class), false); + return new FightBuff(effect_wisdom, Mockito.mock(Spell.class), caster, caster, Mockito.mock(BuffHook.class), false); } } diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandlerTest.java index 94fcc8fed..f64bbf4cc 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/InvisibilityHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -103,7 +103,7 @@ void buffWillAddBuffToListAndHideTarget() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -428,7 +428,7 @@ void buffTerminatedWithOtherBuffNotInvisibilityShouldBeIgnored() { Mockito.when(otherBuffEffect.effect()).thenReturn(144); Mockito.when(otherBuffEffect.duration()).thenReturn(10); - target.buffs().add(new Buff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class))); + target.buffs().add(new FightBuff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class))); assertTrue(target.hidden()); requestStack.clear(); @@ -463,7 +463,7 @@ void onCastWithTwoActiveBuffShouldOnlyShowCellOnce() { SpellEffect otherBuffEffect = Mockito.mock(SpellEffect.class); Mockito.when(otherBuffEffect.effect()).thenReturn(144); Mockito.when(otherBuffEffect.duration()).thenReturn(10); - target.buffs().add(new Buff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class))); + target.buffs().add(new FightBuff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class))); handler.buff(scope, scope.effects().get(0)); handler.buff(scope, scope.effects().get(0)); @@ -487,7 +487,7 @@ void onCastUnitWithoutActiveBuffShouldShowCell() { SpellEffect otherBuffEffect = Mockito.mock(SpellEffect.class); Mockito.when(otherBuffEffect.effect()).thenReturn(144); Mockito.when(otherBuffEffect.duration()).thenReturn(10); - Buff fakeBuff = new Buff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class)); + FightBuff fakeBuff = new FightBuff(otherBuffEffect, Mockito.mock(Spell.class), target, target, Mockito.mock(BuffHook.class)); target.setHidden(target, true); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandlerTest.java index c6bd8d84b..54d1e32bd 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/misc/SkipTurnHandlerTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -80,7 +80,7 @@ void handle() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().findFirst(); + Optional buff = target.buffs().stream().findFirst(); assertTrue(buff.isPresent()); assertSame(effect, buff.get().effect()); @@ -106,7 +106,7 @@ void handleSelfCast() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.handle(scope, scope.effects().get(0)); - Optional buff = caster.buffs().stream().findFirst(); + Optional buff = caster.buffs().stream().findFirst(); assertEquals(2, buff.get().remainingTurns()); } @@ -126,7 +126,7 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff = target.buffs().stream().findFirst(); + Optional buff = target.buffs().stream().findFirst(); assertTrue(buff.isPresent()); assertSame(effect, buff.get().effect()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandlerTest.java index c240ae16f..c655e6d17 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/BoostSpellHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -102,8 +102,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandlerTest.java index c15a36443..6e3e87caa 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/IncreaseWeaponSkillHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.closeCombat.CastableWeapon; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.player.race.DefaultCloseCombat; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -105,8 +105,8 @@ void buff() throws SQLException { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 165).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 165).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 165).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 165).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandlerTest.java index 2a4200468..92d84fe74 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MaximizeTargetEffectsHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -102,8 +102,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandlerTest.java index fef7a39eb..2b09d004c 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MinimizeCastedEffectsHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -102,8 +102,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandlerTest.java index f7bb97d40..27647b1c4 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/modifier/MultiplyDamageHandlerTest.java @@ -25,7 +25,7 @@ import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.EffectValue; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -101,8 +101,8 @@ void buff() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); - Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff1 = caster.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); + Optional buff2 = target.buffs().stream().filter(buff -> buff.effect().effect() == 123).findFirst(); assertTrue(buff1.isPresent()); assertTrue(buff2.isPresent()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandlerTest.java index 592de9485..0f71c3365 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/AvoidDamageByMovingBackHandlerTest.java @@ -23,7 +23,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -95,7 +95,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandlerTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandlerTest.java index 981d93b73..a8dfc5789 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandlerTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/handler/shifting/SwitchPositionOnAttackHandlerTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -96,7 +96,7 @@ void buffWillAddBuffToList() { FightCastScope scope = makeCastScope(caster, spell, effect, target.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertTrue(found.isPresent()); assertEquals(caster, found.get().caster()); @@ -131,7 +131,7 @@ void buffShouldIgnoreSelf() { FightCastScope scope = makeCastScope(caster, spell, effect, caster.cell()); handler.buff(scope, scope.effects().get(0)); - Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); + Optional found = target.buffs().stream().filter(buff -> buff.effect().equals(effect)).findFirst(); assertFalse(found.isPresent()); } diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLostTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLostTest.java index db3f02201..3c33a8a60 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLostTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnActionPointLostTest.java @@ -24,10 +24,8 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; -import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AddCharacteristicHandler; -import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageHandler; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -91,14 +89,14 @@ void apply() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); target.buffs().onCharacteristicAltered(Characteristic.ACTION_POINT, -1); assertEquals(10, target.characteristics().get(Characteristic.FIXED_DAMAGE)); - Buff effectBuff = target.buffs().stream().filter(b -> b.effect().effect() == 96 && b.hook().equals(handler)).findFirst().get(); + FightBuff effectBuff = target.buffs().stream().filter(b -> b.effect().effect() == 96 && b.hook().equals(handler)).findFirst().get(); assertEquals(10, effectBuff.effect().min()); assertEquals(5, effectBuff.remainingTurns()); @@ -126,14 +124,14 @@ void applyMultipleApShouldApplyMultipleTimeEffect() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); target.buffs().onCharacteristicAltered(Characteristic.ACTION_POINT, -3); assertEquals(30, target.characteristics().get(Characteristic.FIXED_DAMAGE)); - List buffs = target.buffs().stream().filter(b -> b.effect().effect() == 96 && b.hook().equals(handler)).collect(Collectors.toList()); + List buffs = target.buffs().stream().filter(b -> b.effect().effect() == 96 && b.hook().equals(handler)).collect(Collectors.toList()); assertCount(3, buffs); assertEquals(10, buffs.get(0).effect().min()); assertEquals(10, buffs.get(1).effect().min()); @@ -167,7 +165,7 @@ void applyWithoutEffectShouldIgnore() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -197,7 +195,7 @@ void applyShouldIgnoredAddingAp() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -227,7 +225,7 @@ void applyShouldIgnoredNotActionPointAlteration() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -257,8 +255,8 @@ void applyArea() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); - Buff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertAll( new AddBuff(buff1), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamageTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamageTest.java index 1596d4381..df9812c55 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamageTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnElementDamageTest.java @@ -25,10 +25,9 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AddCharacteristicHandler; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageApplier; -import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageHandler; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; import fr.quatrevieux.araknemu.game.spell.SpellConstraints; @@ -89,13 +88,13 @@ void apply() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); new DamageApplier(Element.AIR, fight).applyFixed(caster, 1, target); - Buff addedBuff = target.buffs().stream().filter(b -> b.effect().effect() == 145 && b.hook() instanceof AddCharacteristicHandler).findFirst().get(); + FightBuff addedBuff = target.buffs().stream().filter(b -> b.effect().effect() == 145 && b.hook() instanceof AddCharacteristicHandler).findFirst().get(); requestStack.assertAll( ActionEffect.alterLifePoints(caster, target, -1), @@ -125,7 +124,7 @@ void applyElementNotMatchingShouldDoNothing() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -159,8 +158,8 @@ void applyArea() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); - Buff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); + FightBuff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); + FightBuff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 145).findFirst().get(); requestStack.assertAll( new AddBuff(buff1), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHealTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHealTest.java index 8fb210de6..00b06618d 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHealTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/castable/effect/hook/ApplyOnHealTest.java @@ -24,7 +24,7 @@ import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.castable.FightCastScope; import fr.quatrevieux.araknemu.game.fight.castable.effect.Element; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.DamageHandler; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -88,7 +88,7 @@ void apply() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -127,7 +127,7 @@ void applyWithNonEffectiveHeal() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertLast(new AddBuff(buff)); requestStack.clear(); @@ -169,8 +169,8 @@ void applyArea() { assertFalse(hook.apply(handler, scope, scope.effects().get(0))); - Buff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); - Buff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff1 = target.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); + FightBuff buff2 = caster.buffs().stream().filter(b -> b.effect().effect() == 96).findFirst().get(); requestStack.assertAll( new AddBuff(buff1), diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/BaseFighterLifeTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/BaseFighterLifeTest.java index 7835f458d..4f145e7e7 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/BaseFighterLifeTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/BaseFighterLifeTest.java @@ -27,7 +27,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.FightService; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.event.FighterDie; import fr.quatrevieux.araknemu.game.fight.fighter.event.FighterLifeChanged; @@ -316,10 +316,10 @@ void healShouldCallOnLifeAlteredBuffs() { life.damage(fighter, 50); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); - Mockito.doCallRealMethod().when(hook).onHealApplied(Mockito.any(Buff.class), Mockito.anyInt()); + Mockito.doCallRealMethod().when(hook).onHealApplied(Mockito.any(FightBuff.class), Mockito.anyInt()); life.heal(fighter, 10); @@ -331,7 +331,7 @@ void healShouldCallOnHealAppliedBuffs() { life.damage(fighter, 50); BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); life.heal(fighter, 10); @@ -342,7 +342,7 @@ void healShouldCallOnHealAppliedBuffs() { @Test void healShouldCallOnHealAppliedBuffsEvenIfNoEffect() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); life.heal(fighter, 10); @@ -353,10 +353,10 @@ void healShouldCallOnHealAppliedBuffsEvenIfNoEffect() { @Test void damageShouldCallOnLifeAlteredBuffs() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); - Mockito.doCallRealMethod().when(hook).onDamageApplied(Mockito.any(Buff.class), Mockito.anyInt()); + Mockito.doCallRealMethod().when(hook).onDamageApplied(Mockito.any(FightBuff.class), Mockito.anyInt()); life.damage(fighter, 10); @@ -366,7 +366,7 @@ void damageShouldCallOnLifeAlteredBuffs() { @Test void damageShouldCallOnDamageAppliedBuffs() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); life.damage(fighter, 10); @@ -377,7 +377,7 @@ void damageShouldCallOnDamageAppliedBuffs() { @Test void damageShouldCallOnDamageAppliedBuffsEvenWithNoDamage() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); life.damage(fighter, 0); @@ -388,7 +388,7 @@ void damageShouldCallOnDamageAppliedBuffsEvenWithNoDamage() { @Test void damageShouldNotCallOnLifeAlteredBuffsWhenDie() { BuffHook hook = Mockito.mock(BuffHook.class); - Buff buff = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); + FightBuff buff = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), fighter, fighter, hook); fighter.buffs().add(buff); life.damage(fighter, 1000); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/monster/MonsterFighterCharacteristicsTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/monster/MonsterFighterCharacteristicsTest.java index 4120ec29a..e74b9c474 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/monster/MonsterFighterCharacteristicsTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/fighter/monster/MonsterFighterCharacteristicsTest.java @@ -28,8 +28,6 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.FightService; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.FighterFactory; import fr.quatrevieux.araknemu.game.fight.fighter.event.FighterCharacteristicChanged; import fr.quatrevieux.araknemu.game.fight.map.FightMap; @@ -40,16 +38,12 @@ import fr.quatrevieux.araknemu.game.monster.environment.RandomCellSelector; import fr.quatrevieux.araknemu.game.monster.group.MonsterGroup; import fr.quatrevieux.araknemu.game.monster.group.MonsterGroupFactory; -import fr.quatrevieux.araknemu.game.spell.Spell; -import fr.quatrevieux.araknemu.game.spell.effect.SpellEffect; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.mockito.Mockito; import java.time.Duration; import java.util.Arrays; import java.util.Collections; -import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/fr/quatrevieux/araknemu/game/fight/turn/FightTurnTest.java b/src/test/java/fr/quatrevieux/araknemu/game/fight/turn/FightTurnTest.java index 3e62c10ef..8284dfef2 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/fight/turn/FightTurnTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/fight/turn/FightTurnTest.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.exception.FightException; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; @@ -232,7 +232,7 @@ void stopWillDecrementBuffRemainingTurnsAndCallEndTurn() { SpellEffect effect = Mockito.mock(SpellEffect.class); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), new BuffHook() {}); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), new BuffHook() {}); player.fighter().buffs().add(buff); @@ -249,7 +249,7 @@ void stopWillRemoveExpiredBuff() { BuffHook hook = Mockito.mock(BuffHook.class); Mockito.when(effect.duration()).thenReturn(0); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); Mockito.when(hook.onStartTurn(buff)).thenReturn(true); player.fighter().buffs().add(buff); @@ -282,7 +282,7 @@ void startWithSkipTurnBuff() { Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); Mockito.when(hook.onStartTurn(buff)).thenReturn(false); player.fighter().buffs().add(buff); @@ -345,7 +345,7 @@ void startStopWillCallBuffHook() { Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), hook); Mockito.when(hook.onStartTurn(buff)).thenReturn(true); player.fighter().buffs().add(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuffTest.java b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuffTest.java index 3fd44e98c..983043e10 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuffTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/DispelDeadFighterBuffTest.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.event.FighterDie; import fr.quatrevieux.araknemu.game.listener.fight.CheckFightTerminated; @@ -59,9 +59,9 @@ public void setUp() throws Exception { @Test void onFighterDie() { - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), Mockito.mock(BuffHook.class), false); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class), true); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), Mockito.mock(BuffHook.class), false); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class), true); player.fighter().buffs().add(buff1); player.fighter().buffs().add(buff2); @@ -91,9 +91,9 @@ void onFighterDieWithoutBuff() { void functional() { fight.dispatcher().add(listener); - Buff buff1 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); - Buff buff3 = new Buff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), player.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); + FightBuff buff3 = new FightBuff(Mockito.mock(SpellEffect.class), Mockito.mock(Spell.class), other.fighter(), player.fighter(), Mockito.mock(BuffHook.class)); player.fighter().buffs().add(buff1); player.fighter().buffs().add(buff2); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/RefreshBuffsTest.java b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/RefreshBuffsTest.java index dd7dc95d4..9446dffa0 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/RefreshBuffsTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/fighter/RefreshBuffsTest.java @@ -21,7 +21,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; import fr.quatrevieux.araknemu.game.fight.turn.FightTurn; @@ -60,7 +60,7 @@ void onTurnTerminated() { SpellEffect effect = Mockito.mock(SpellEffect.class); Mockito.when(effect.duration()).thenReturn(5); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), new BuffHook() {}); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), other.fighter(), player.fighter(), new BuffHook() {}); fighter.buffs().add(buff); diff --git a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectatorTest.java b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectatorTest.java index 3cde5216b..c2f924323 100644 --- a/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectatorTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/game/listener/fight/spectator/SendFightStateToSpectatorTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.exploration.map.ExplorationMapService; import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.player.PlayerFighter; @@ -137,8 +137,8 @@ void onStartWatchFightWithBuffs() throws SQLException { Mockito.when(effect2.min()).thenReturn(80); Mockito.when(effect2.duration()).thenReturn(10); - Buff buff1 = new Buff(effect1, Mockito.mock(Spell.class), getFighter(0), getFighter(0), Mockito.mock(BuffHook.class)); - Buff buff2 = new Buff(effect2, Mockito.mock(Spell.class), getFighter(0), getFighter(0), Mockito.mock(BuffHook.class)); + FightBuff buff1 = new FightBuff(effect1, Mockito.mock(Spell.class), getFighter(0), getFighter(0), Mockito.mock(BuffHook.class)); + FightBuff buff2 = new FightBuff(effect2, Mockito.mock(Spell.class), getFighter(0), getFighter(0), Mockito.mock(BuffHook.class)); getFighter(0).buffs().add(buff1); getFighter(0).buffs().add(buff2); diff --git a/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuffTest.java b/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuffTest.java index c665bfbd3..96fa00ba9 100644 --- a/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuffTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/AddBuffTest.java @@ -20,7 +20,7 @@ package fr.quatrevieux.araknemu.network.game.out.fight; import fr.quatrevieux.araknemu.game.fight.castable.Castable; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.BuffHook; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.spell.Spell; @@ -45,7 +45,7 @@ void generate() { Mockito.when(fighter.id()).thenReturn(123); Mockito.when(spell.id()).thenReturn(456); - Buff buff = new Buff(effect, spell, fighter, fighter, Mockito.mock(BuffHook.class)); + FightBuff buff = new FightBuff(effect, spell, fighter, fighter, Mockito.mock(BuffHook.class)); assertEquals("GIE99;123;5;7;0;;3;456", new AddBuff(buff).toString()); } @@ -63,7 +63,7 @@ void generateWithoutMax() { Mockito.when(fighter.id()).thenReturn(123); Mockito.when(spell.id()).thenReturn(456); - Buff buff = new Buff(effect, spell, fighter, fighter, Mockito.mock(BuffHook.class)); + FightBuff buff = new FightBuff(effect, spell, fighter, fighter, Mockito.mock(BuffHook.class)); assertEquals("GIE99;123;5;;0;;3;456", new AddBuff(buff).toString()); } @@ -80,7 +80,7 @@ void generateWithoutSpell() { Mockito.when(effect.text()).thenReturn(""); Mockito.when(fighter.id()).thenReturn(123); - Buff buff = new Buff(effect, castable, fighter, fighter, Mockito.mock(BuffHook.class)); + FightBuff buff = new FightBuff(effect, castable, fighter, fighter, Mockito.mock(BuffHook.class)); assertEquals("GIE99;123;5;;0;;3;", new AddBuff(buff).toString()); } diff --git a/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffectTest.java b/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffectTest.java index decea93b0..48cf9b499 100644 --- a/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffectTest.java +++ b/src/test/java/fr/quatrevieux/araknemu/network/game/out/fight/action/ActionEffectTest.java @@ -22,7 +22,7 @@ import fr.quatrevieux.araknemu.game.fight.Fight; import fr.quatrevieux.araknemu.game.fight.FightBaseCase; import fr.quatrevieux.araknemu.game.fight.FighterSprite; -import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.Buff; +import fr.quatrevieux.araknemu.game.fight.castable.effect.buff.FightBuff; import fr.quatrevieux.araknemu.game.fight.fighter.Fighter; import fr.quatrevieux.araknemu.game.fight.fighter.invocation.DoubleFighter; import fr.quatrevieux.araknemu.game.fight.fighter.invocation.InvocationFighter; @@ -165,7 +165,7 @@ void buff() { Mockito.when(caster.id()).thenReturn(123); Mockito.when(target.id()).thenReturn(456); - Buff buff = new Buff(effect, Mockito.mock(Spell.class), caster, target, null); + FightBuff buff = new FightBuff(effect, Mockito.mock(Spell.class), caster, target, null); assertEquals("GA;111;123;456,3,5", ActionEffect.buff(buff, 3).toString()); assertEquals("GA;111;123;456,-3,5", ActionEffect.buff(buff, -3).toString());