Commit 8daf90f 1 parent ef47ab9 commit 8daf90f Copy full SHA for 8daf90f
File tree 2 files changed +6
-1
lines changed
core/src/main/java/com/pipai/wf
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 8
8
import com .pipai .wf .battle .damage .TargetedActionCalculator ;
9
9
import com .pipai .wf .battle .damage .WeaponDamageFunction ;
10
10
import com .pipai .wf .battle .log .BattleEvent ;
11
+ import com .pipai .wf .battle .weapon .Rifle ;
11
12
import com .pipai .wf .battle .weapon .Weapon ;
12
13
import com .pipai .wf .exception .IllegalActionException ;
13
14
import com .pipai .wf .unit .ability .Ability ;
@@ -57,6 +58,9 @@ protected void performImpl() throws IllegalActionException {
57
58
}
58
59
Agent target = getTarget ();
59
60
Weapon w = a .getCurrentWeapon ();
61
+ if (!(w instanceof Rifle )) {
62
+ throw new IllegalActionException ("Rifle needed to use Precision Shot" );
63
+ }
60
64
if (w .needsAmmunition () && w .currentAmmo () == 0 ) {
61
65
throw new IllegalActionException ("Not enough ammo to fire " + w .name ());
62
66
}
Original file line number Diff line number Diff line change 36
36
import com .pipai .wf .battle .map .MapGraph ;
37
37
import com .pipai .wf .battle .spell .FireballSpell ;
38
38
import com .pipai .wf .battle .vision .FogOfWar ;
39
+ import com .pipai .wf .battle .weapon .Rifle ;
39
40
import com .pipai .wf .battle .weapon .SpellWeapon ;
40
41
import com .pipai .wf .battle .weapon .Weapon ;
41
42
import com .pipai .wf .exception .IllegalActionException ;
@@ -639,7 +640,7 @@ public void onKeyDown(int keycode) {
639
640
// Skill
640
641
if (this .mode == Mode .MOVE ) {
641
642
for (Ability a : selectedAgent .getAgent ().getAbilities ()) {
642
- if (a instanceof PrecisionShotAbility && !a .isOnCooldown ()) {
643
+ if (a instanceof PrecisionShotAbility && !a .isOnCooldown () && selectedAgent . getAgent (). getCurrentWeapon () instanceof Rifle ) {
643
644
this .switchToTargetMode ((PrecisionShotAbility ) a );
644
645
break ;
645
646
}
You can’t perform that action at this time.
0 commit comments