Test Failed
Branch master (8e433c)
by Vincent
18:50
created

onCastTarget(Buff,CastScope)   A

Complexity

Conditions 1

Size

Total Lines 1
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
dl 0
loc 1
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
/*
2
 * This file is part of Araknemu.
3
 *
4
 * Araknemu is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU Lesser General Public License as published by
6
 * the Free Software Foundation, either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * Araknemu is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public License
15
 * along with Araknemu.  If not, see <https://www.gnu.org/licenses/>.
16
 *
17
 * Copyright (c) 2017-2019 Vincent Quatrevieux
18
 */
19
20
package fr.quatrevieux.araknemu.game.fight.castable.effect.buff;
21
22
import fr.quatrevieux.araknemu.game.fight.castable.CastScope;
23
import fr.quatrevieux.araknemu.game.fight.castable.effect.handler.damage.Damage;
24
25
/**
26
 * Hook action for apply buff effects
27
 */
28
public interface BuffHook {
29
    /**
30
     * Apply effect when fighter turn is started
31
     *
32
     * @return False if the fighter cannot start the turn
33
     */
34
    public default boolean onStartTurn(Buff buff) {
35 1
        return true;
36
    }
37
38
    /**
39
     * Apply effect on turn ending
40
     */
41 1
    public default void onEndTurn(Buff buff) {}
42
43
    /**
44
     * Start the buff
45
     */
46 1
    public default void onBuffStarted(Buff buff) {}
47
48
    /**
49
     * The buff is terminated (buff expired, debuff...)
50
     */
51 1
    public default void onBuffTerminated(Buff buff) {}
52
53
    /**
54
     * The fighter is a target of a cast
55
     */
56 1
    public default void onCastTarget(Buff buff, CastScope cast) {}
57
58
    /**
59
     * The fighter will take damages
60
     */
61 1
    public default void onDamage(Buff buff, Damage value) {}
62
63
    /**
64
     * The fighter life has been altered
65
     *
66
     * Unlike {@link BuffHook#onDamage(Buff, Damage)}, the effects has already been applied
67
     *
68
     * @param buff The active buff
69
     * @param value Altered life value. Negative for a damage, positive for a heal
70
     *
71
     * @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#alter(fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter, int)
72
     */
73 1
    public default void onLifeAltered(Buff buff, int value) {}
74
}
75