|
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
|
|
|
import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Hook action for apply buff effects |
|
28
|
|
|
*/ |
|
29
|
|
|
public interface BuffHook { |
|
30
|
|
|
/** |
|
31
|
|
|
* Apply effect when fighter turn is started |
|
32
|
|
|
* |
|
33
|
|
|
* @return False if the fighter cannot start the turn |
|
34
|
|
|
*/ |
|
35
|
|
|
public default boolean onStartTurn(Buff buff) { |
|
36
|
1 |
|
return true; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Apply effect on turn ending |
|
41
|
|
|
*/ |
|
42
|
1 |
|
public default void onEndTurn(Buff buff) {} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Start the buff |
|
46
|
|
|
*/ |
|
47
|
1 |
|
public default void onBuffStarted(Buff buff) {} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* The buff is terminated (buff expired, debuff...) |
|
51
|
|
|
*/ |
|
52
|
1 |
|
public default void onBuffTerminated(Buff buff) {} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* The fighter is a target of a cast |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public default void onCastTarget(Buff buff, CastScope cast) {} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* The fighter will take damages |
|
61
|
|
|
*/ |
|
62
|
1 |
|
public default void onDamage(Buff buff, Damage value) {} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* The fighter will take damages |
|
66
|
|
|
*/ |
|
67
|
|
|
public default void onDirectDamage(Buff buff, ActiveFighter caster, Damage value) { |
|
68
|
1 |
|
onDamage(buff, value); |
|
69
|
1 |
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* The fighter will take damages by a buff (i.e. poison) |
|
73
|
|
|
* |
|
74
|
|
|
* @param buff The current buff |
|
75
|
|
|
* @param poison The poison buff |
|
76
|
|
|
* @param value The damage to apply |
|
77
|
|
|
*/ |
|
78
|
|
|
public default void onBuffDamage(Buff buff, Buff poison, Damage value) { |
|
79
|
1 |
|
onDamage(buff, value); |
|
80
|
1 |
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* The fighter life has been altered |
|
84
|
|
|
* |
|
85
|
|
|
* Unlike {@link BuffHook#onDamage(Buff, Damage)}, the effects has already been applied |
|
86
|
|
|
* |
|
87
|
|
|
* @param buff The active buff |
|
88
|
|
|
* @param value Altered life value. Negative for a damage, positive for a heal |
|
89
|
|
|
* |
|
90
|
|
|
* @see fr.quatrevieux.araknemu.game.fight.fighter.FighterLife#alter(fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter, int) |
|
91
|
|
|
*/ |
|
92
|
1 |
|
public default void onLifeAltered(Buff buff, int value) {} |
|
93
|
|
|
} |
|
94
|
|
|
|