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 movement points |
29
|
|
|
* |
30
|
|
|
* Like {@link MovementPointLostHandler} the removal can be dodged |
31
|
|
|
* This effect is equivalent to apply {@link MovementPointLostHandler} chained with {@link fr.quatrevieux.araknemu.game.fight.castable.effect.handler.characteristic.AddMovementPointsHandler} |
32
|
|
|
* |
33
|
|
|
* In case of direct effect (i.e. without duration), movement points will simply be added to the current turn |
34
|
|
|
*/ |
35
|
|
|
public final class StealMovementPointHandler extends AbstractStealPointHandler { |
36
|
|
|
/** |
37
|
|
|
* @param fight Fight where the effect will be applied |
38
|
|
|
* @param removeMovementPointEffect Effect id used by the "remove movement point" buff |
39
|
|
|
* @param addMovementPointEffect Effect id used by the "add movement point" buff |
40
|
|
|
*/ |
41
|
|
|
public StealMovementPointHandler(Fight fight, int removeMovementPointEffect, int addMovementPointEffect) { |
42
|
1 |
|
super( |
43
|
|
|
fight, |
44
|
|
|
new MovementPointLostApplier(fight, removeMovementPointEffect), |
45
|
1 |
|
AlterPointHook.addMovementPoint(fight), |
46
|
|
|
addMovementPointEffect |
47
|
|
|
); |
48
|
1 |
|
} |
49
|
|
|
|
50
|
|
|
@Override |
51
|
|
|
protected void applyOnCurrentTurn(Fight fight, Turn turn, ActiveFighter caster, int toAdd) { |
52
|
1 |
|
turn.points().addMovementPoints(toAdd); |
53
|
1 |
|
fight.send(ActionEffect.addMovementPoints(caster, toAdd)); |
54
|
1 |
|
} |
55
|
|
|
} |
56
|
|
|
|