Addition knockback perk for Earth Kit

Adds a perk so that the Earth kit takes 75% less knockback while on the
ground
This commit is contained in:
Sam 2016-07-19 20:49:27 +01:00
parent 0390822fd7
commit 588e32e1b1
2 changed files with 26 additions and 7 deletions

View File

@ -11,6 +11,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDirtCannon;
import nautilus.game.arcade.kit.perks.PerkKnockback;
public class KitEarth extends ProgressingKit
{
@ -21,28 +22,34 @@ public class KitEarth extends ProgressingKit
receiveItem("Dirt", 1, 20, 4),
"Right Click " + C.cGreen + "Dirt" + C.cWhite + " to fire a " + C.cGreen + "Dirt" + C.cWhite + " block that deals",
"knockback and damage to any player it hits.",
"You also take recoil knockback."
"You take " + C.cGreen + "75%" + C.cWhite + " less knockback"
};
private static final Perk[][] PERKS =
{
{
new PerkDirtCannon(2, 1)
new PerkDirtCannon(2),
new PerkKnockback(0.25)
},
{
new PerkDirtCannon(2, .5)
new PerkDirtCannon(2),
new PerkKnockback(0.25)
},
{
new PerkDirtCannon(2, .5)
new PerkDirtCannon(2),
new PerkKnockback(0.24)
},
{
new PerkDirtCannon(2, .5)
new PerkDirtCannon(2),
new PerkKnockback(0.24)
},
{
new PerkDirtCannon(2.5, .5)
new PerkDirtCannon(2.5),
new PerkKnockback(0.24)
},
{
new PerkDirtCannon(2.5, .5)
new PerkDirtCannon(2.5),
new PerkKnockback(0.24)
},
};

View File

@ -16,8 +16,14 @@ import nautilus.game.arcade.kit.Perk;
public class PerkKnockback extends Perk
{
private double _power;
private boolean _onGround;
public PerkKnockback(double power)
{
this(power, false);
}
public PerkKnockback(double power, boolean onGround)
{
super("Knockback", new String[]
{
@ -25,6 +31,7 @@ public class PerkKnockback extends Perk
});
_power = power;
_onGround = onGround;
}
@EventHandler(priority = EventPriority.HIGH)
@ -38,6 +45,11 @@ public class PerkKnockback extends Perk
if (!Manager.IsAlive(damager))
return;
if (_onGround && !UtilEnt.isGrounded(event.GetDamageeEntity()))
{
return;
}
event.SetKnockback(false);