mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-27 07:36:46 +01:00
commit
abcd586daa
@ -171,12 +171,12 @@ public class Combat
|
|||||||
/*
|
/*
|
||||||
* DEFENSIVE CHECKS FOR WOLVES
|
* DEFENSIVE CHECKS FOR WOLVES
|
||||||
*/
|
*/
|
||||||
else if(target instanceof Wolf)
|
//else if(target instanceof Wolf)
|
||||||
{
|
//{
|
||||||
Wolf wolf = (Wolf) target;
|
// Wolf wolf = (Wolf) target;
|
||||||
if(wolf.isTamed() && (wolf.getOwner() instanceof Player))
|
// if(wolf.isTamed() && (wolf.getOwner() instanceof Player))
|
||||||
Taming.preventDamage(event, pluginx);
|
// Taming.preventDamage(event, pluginx);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa)
|
public static void combatAbilityChecks(Player attacker, PlayerProfile PPa)
|
||||||
|
@ -113,26 +113,47 @@ public class Taming
|
|||||||
public static void preventDamage(EntityDamageEvent event, mcMMO plugin)
|
public static void preventDamage(EntityDamageEvent event, mcMMO plugin)
|
||||||
{
|
{
|
||||||
DamageCause cause = event.getCause();
|
DamageCause cause = event.getCause();
|
||||||
Entity entity = event.getEntity();
|
Wolf wolf = (Wolf) event.getEntity();
|
||||||
Wolf theWolf = (Wolf)entity;
|
Player master = (Player) wolf.getOwner();
|
||||||
Player master = (Player)theWolf.getOwner();
|
|
||||||
int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING);
|
int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING);
|
||||||
|
|
||||||
|
switch(cause)
|
||||||
|
{
|
||||||
//Environmentally Aware
|
//Environmentally Aware
|
||||||
if((cause == DamageCause.CONTACT || cause == DamageCause.LAVA || cause == DamageCause.FIRE) && skillLevel >= 100)
|
case CONTACT:
|
||||||
|
case LAVA:
|
||||||
|
case FIRE:
|
||||||
|
if(skillLevel >= 100)
|
||||||
{
|
{
|
||||||
if(event.getDamage() < theWolf.getHealth())
|
if(event.getDamage() >= wolf.getHealth())
|
||||||
{
|
return;
|
||||||
entity.teleport(master.getLocation());
|
|
||||||
|
wolf.teleport(master.getLocation());
|
||||||
master.sendMessage(mcLocale.getString("mcEntityListener.WolfComesBack")); //$NON-NLS-1$
|
master.sendMessage(mcLocale.getString("mcEntityListener.WolfComesBack")); //$NON-NLS-1$
|
||||||
entity.setFireTicks(0);
|
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
if(cause == DamageCause.FALL && skillLevel >= 100)
|
case FALL:
|
||||||
|
if(skillLevel >= 100)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
break;
|
||||||
|
|
||||||
//Thick Fur
|
//Thick Fur
|
||||||
if(cause == DamageCause.FIRE_TICK)
|
case FIRE_TICK:
|
||||||
event.getEntity().setFireTicks(0);
|
if(skillLevel >= 250)
|
||||||
|
wolf.setFireTicks(0);
|
||||||
|
break;
|
||||||
|
case ENTITY_ATTACK:
|
||||||
|
case PROJECTILE:
|
||||||
|
if(skillLevel >= 250)
|
||||||
|
event.setDamage(event.getDamage() / 2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Shock Proof
|
||||||
|
case ENTITY_EXPLOSION:
|
||||||
|
case BLOCK_EXPLOSION:
|
||||||
|
if(skillLevel >= 500)
|
||||||
|
event.setDamage(event.getDamage() / 6);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user