[718] Dragonfire Shield (PvP Only)
Hey guys, just a quick snippet for the Dragonfire shield for PvP :)
What it has;
- Base 200 damage with a random number up to 100 (if a player isn't wearing antifire shield if so then it's divided by 10)
- Includes real animations and gfx
- 30 second timer between specials
- Cannot be activated outside of combat
- Checks if you have any other form of dragonfire protection
- Negates all damage if you're using both antifire shield/DFS and potion.
ButtonHandler.java
Code:
if (componentId == 21) {
if (packetId == WorldPacketsDecoder.ACTION_BUTTON2_PACKET) {
if (player.getEquipment().getShieldId() == 11283) {
Long dfsCharge = (Long) player.getTemporaryAttributtes().get("LAST_DFS");
if (dfsCharge != null && dfsCharge + 30000 > Utils.currentTimeMillis()) {
player.sm("Players may only use the Dragonfire shield special once every 30 seconds.");
return;
}
if (player.getActionManager().getAction() instanceof PlayerCombat) {
player.dfsActivate = true;
} else {
player.sm("You must be under combat to do this.");
}
}
return;
}
}
Player.java
Code:
if (dfsActivate == true) {
int damage = 100 + Utils.getRandom(550);
final Player p2 = (Player) source;
dfsActivate = false;
getTemporaryAttributtes().put("LAST_DFS", Utils.currentTimeMillis());
setNextGraphics(new Graphics(1165));
setNextAnimation(new Animation(6696));
if(p2.getFireImmune() >= Utils.currentTimeMillis()) {
damage = Utils.random(100);
p2.sm("Your antifire potion absorbs most of the firey attack!");
World.sendProjectile(this, p2, 1166, 41, 16, 31, 35, 16, 0);
p2.applyHit(new Hit(this, damage, HitLook.REGULAR_DAMAGE));
return;
}
if(Combat.hasAntiDragProtection(p2)) {
damage = Utils.random(100);
p2.sm("Your Dragonfire shield absorbs most of the firey attack!");
World.sendProjectile(this, p2, 1166, 41, 16, 31, 35, 16, 0);
p2.applyHit(new Hit(this, damage, HitLook.REGULAR_DAMAGE));
return;
}
if(p2.getFireImmune() >= Utils.currentTimeMillis() && Combat.hasAntiDragProtection(p2)) {
damage = 0;
p2.sm("Due to the nature of your shield and potion you take no damage.");
World.sendProjectile(this, p2, 1166, 41, 16, 31, 35, 16, 0);
p2.applyHit(new Hit(this, damage, HitLook.REGULAR_DAMAGE));
return;
}
p2.sm("You are horribly burnt by the firey attack!");
World.sendProjectile(this, p2, 1166, 41, 16, 31, 35, 16, 0);
p2.applyHit(new Hit(this, 200 + Utils.random(100), HitLook.REGULAR_DAMAGE));
}
This was quickly written, please leave feedback if you think this can be improve.
Please leave a thanks if you have used this.
[Only registered and activated users can see links. Click Here To Register...]