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-2021 Vincent Quatrevieux |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
package fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.point; |
21
|
|
|
|
22
|
|
|
import fr.quatrevieux.araknemu.game.fight.Fight; |
23
|
|
|
import fr.quatrevieux.araknemu.game.fight.fighter.ActiveFighter; |
24
|
|
|
import fr.quatrevieux.araknemu.game.fight.turn.Turn; |
25
|
|
|
import fr.quatrevieux.araknemu.network.game.out.fight.action.ActionEffect; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Effect for steal action points |
29
|
|
|
* |
30
|
|
|
* Like {@link ActionPointLostHandler} the removal can be dodged |
31
|
|
|
* This effect is equivalent to apply {@link ActionPointLostHandler} chained with {@link fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AddActionPointsHandler} |
32
|
|
|
* |
33
|
|
|
* In case of direct effect (i.e. without duration), action points will simply be added to the current turn |
34
|
|
|
*/ |
35
|
|
|
public final class StealActionPointHandler extends AbstractStealPointHandler { |
36
|
|
|
/** |
37
|
|
|
* @param fight Fight where the effect will be applied |
38
|
|
|
* @param removeActionPointEffect Effect id used by the "remove action point" buff |
39
|
|
|
* @param addActionPointEffect Effect id used by the "add action point" buff |
40
|
|
|
*/ |
41
|
|
|
public StealActionPointHandler(Fight fight, int removeActionPointEffect, int addActionPointEffect) { |
42
|
1 |
|
super( |
43
|
|
|
fight, |
44
|
|
|
new ActionPointLostApplier(fight, removeActionPointEffect), |
45
|
1 |
|
AlterPointHook.addActionPoint(fight), |
46
|
|
|
addActionPointEffect |
47
|
|
|
); |
48
|
1 |
|
} |
49
|
|
|
|
50
|
|
|
@Override |
51
|
|
|
protected void applyOnCurrentTurn(Fight fight, Turn turn, ActiveFighter caster, int toAdd) { |
52
|
1 |
|
turn.points().addActionPoints(toAdd); |
53
|
1 |
|
fight.send(ActionEffect.addActionPoints(caster, toAdd)); |
54
|
1 |
|
} |
55
|
|
|
} |
56
|
|
|
|