Fixed arrow boucing off entities on daze proc

This commit is contained in:
bm01 2012-05-08 21:58:01 +02:00
parent 06f97ac2f1
commit 5fa79926db
3 changed files with 14 additions and 13 deletions

View File

@ -20,6 +20,7 @@ Version 1.3.07
+ Added config options for enabling/disabling specific double drops + Added config options for enabling/disabling specific double drops
+ Added automatic zip backup of flatfile database & config files + Added automatic zip backup of flatfile database & config files
+ Added config options to enable/disable specific skills for PVP & PVE + Added config options to enable/disable specific skills for PVP & PVE
= Fixed bug where an arrow could bounce off entities on daze proc
= Fixed bug where a player could gain Acrobatics experience while riding a cart = Fixed bug where a player could gain Acrobatics experience while riding a cart
= Fixed /party not working properly with 2 arguments = Fixed /party not working properly with 2 arguments
= Fixed /ability not checking the right permission = Fixed /ability not checking the right permission

View File

@ -10,13 +10,13 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Users; import com.gmail.nossr50.util.Users;
@ -53,8 +53,9 @@ public class Archery {
* *
* @param defender Defending player * @param defender Defending player
* @param attacker Attacking player * @param attacker Attacking player
* @param event The event to modify
*/ */
public static void dazeCheck(Player defender, Player attacker) { public static void dazeCheck(Player defender, Player attacker, EntityDamageByEntityEvent event) {
final int MAX_BONUS_LEVEL = 1000; final int MAX_BONUS_LEVEL = 1000;
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY); int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
@ -70,7 +71,7 @@ public class Archery {
if (random.nextInt(2000) <= skillCheck) { if (random.nextInt(2000) <= skillCheck) {
defender.teleport(loc); defender.teleport(loc);
Combat.dealDamage(defender, 4); event.setDamage(event.getDamage() + 4);
defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy")); defender.sendMessage(LocaleLoader.getString("Combat.TouchedFuzzy"));
attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed")); attacker.sendMessage(LocaleLoader.getString("Combat.TargetDazed"));
} }

View File

@ -265,9 +265,8 @@ public class Combat {
if (shooter instanceof Player) { if (shooter instanceof Player) {
Player attacker = (Player) shooter; Player attacker = (Player) shooter;
PlayerProfile PPa = Users.getProfile(attacker); PlayerProfile PPa = Users.getProfile(attacker);
int damage = event.getDamage();
if (permInstance.archery(attacker) && damage > 0) { if (permInstance.archery(attacker)) {
if (permInstance.archeryBonus(attacker)) { if (permInstance.archeryBonus(attacker)) {
/*Archery needs a damage bonus to be viable in PVP*/ /*Archery needs a damage bonus to be viable in PVP*/
int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY); int skillLvl = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
@ -280,8 +279,14 @@ public class Combat {
/* Every 50 skill levels Archery gains 10% damage bonus, set that here */ /* Every 50 skill levels Archery gains 10% damage bonus, set that here */
//TODO: Work in progress for balancing out Archery, will work on it more later... //TODO: Work in progress for balancing out Archery, will work on it more later...
int archeryBonus = (int)(event.getDamage() * dmgBonusPercent); int damage = event.getDamage();
event.setDamage(event.getDamage() + archeryBonus); int archeryBonus = (int) (damage * dmgBonusPercent);
event.setDamage(damage + archeryBonus);
}
if (target instanceof Player && permInstance.daze(attacker)) {
Archery.dazeCheck((Player) target, attacker, event);
} }
if (permInstance.trackArrows(attacker)) { if (permInstance.trackArrows(attacker)) {
@ -291,12 +296,6 @@ public class Combat {
if (target != attacker) { if (target != attacker) {
startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx); startGainXp(attacker, PPa, target, SkillType.ARCHERY, pluginx);
} }
if (target instanceof Player) {
if (permInstance.daze(attacker)) {
Archery.dazeCheck((Player) target, attacker);
}
}
} }
} }
} }