From 1b15828d08bc247513a9e9786307c98540fd5b34 Mon Sep 17 00:00:00 2001 From: GJ Date: Wed, 21 Mar 2012 17:35:08 -0400 Subject: [PATCH] More work on Staves. --- .../java/com/gmail/nossr50/skills/Staves.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/Staves.java b/src/main/java/com/gmail/nossr50/skills/Staves.java index ca9cafa6f..48160d052 100644 --- a/src/main/java/com/gmail/nossr50/skills/Staves.java +++ b/src/main/java/com/gmail/nossr50/skills/Staves.java @@ -4,6 +4,7 @@ import java.util.Collection; import org.bukkit.Material; import org.bukkit.entity.Egg; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Fireball; import org.bukkit.entity.LivingEntity; @@ -22,7 +23,7 @@ public class Staves { public static void altFireCheck(EntityDamageByEntityEvent event) { LivingEntity defender = (LivingEntity) event.getEntity(); - Projectile attacker = (Projectile) event.getDamager(); + Entity attacker = event.getDamager(); if (attacker.hasMetadata("mcmmoFiredFromStaff")) { event.setDamage(0); @@ -43,7 +44,7 @@ public class Staves { snowballEffect((Player) defender, shooter); } break; - + default: break; } @@ -135,11 +136,16 @@ public class Staves { * @param shooter Player who fired the projectile */ private static void snowballEffect(Player target, Player shooter) { + int expLost = expLossCalculate(); + int expGained = expGainCalculate(); + if (Party.getInstance().inSameParty(target, shooter)) { - + target.giveExp(expGained); } else { - + System.out.println(shooter.getLevel()); + shooter.setLevel(shooter.getLevel() - 2); + System.out.println(shooter.getLevel()); } } @@ -153,13 +159,13 @@ public class Staves { return 10; } - private static int levelLossCalculate() { - //TODO: Calculate levels lost based on time held - return 2; + private static int expLossCalculate() { + //TODO: Calculate exp lost based on time held + return 1000; } - private static int levelGainCalculate() { - //TODO: Calculate levels gained based on skill level - return 1; + private static int expGainCalculate() { + //TODO: Calculate exp gained based on skill level + return 500; } }