mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
Moved Taming stuff into Taming.java
This commit is contained in:
parent
4826056bbe
commit
a3f0de1c84
@ -169,73 +169,38 @@ public class Combat
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OFFENSIVE CHECKS FOR WOLVES VERSUS ENTITIES
|
* TAMING (WOLVES VERSUS ENTITIES)
|
||||||
*/
|
*/
|
||||||
if(event instanceof EntityDamageByEntityEvent && ((EntityDamageByEntityEvent) event).getDamager() instanceof Wolf)
|
if(event instanceof EntityDamageByEntityEvent && ((EntityDamageByEntityEvent) event).getDamager() instanceof Wolf)
|
||||||
{
|
{
|
||||||
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent) event;
|
||||||
Wolf theWolf = (Wolf) eventb.getDamager();
|
Wolf theWolf = (Wolf) eventb.getDamager();
|
||||||
|
|
||||||
if(theWolf.isTamed() && Taming.ownerOnline(theWolf, pluginx))
|
if(theWolf.isTamed() && Taming.ownerOnline(theWolf, pluginx))
|
||||||
{
|
{
|
||||||
if(Taming.getOwner(theWolf, pluginx) == null)
|
if(Taming.getOwner(theWolf, pluginx) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player master = Taming.getOwner(theWolf, pluginx);
|
Player master = Taming.getOwner(theWolf, pluginx);
|
||||||
PlayerProfile PPo = Users.getProfile(master);
|
PlayerProfile PPo = Users.getProfile(master);
|
||||||
|
|
||||||
if(mcPermissions.getInstance().taming(master))
|
if(mcPermissions.getInstance().taming(master))
|
||||||
{
|
{
|
||||||
//Fast Food Service
|
//Fast Food Service
|
||||||
if(PPo.getSkillLevel(SkillType.TAMING) >= 50)
|
Taming.fastFoodService(PPo, theWolf, event);
|
||||||
{
|
|
||||||
if(theWolf.getHealth() < theWolf.getMaxHealth())
|
|
||||||
{
|
|
||||||
if(Math.random() * 10 > 5)
|
|
||||||
{
|
|
||||||
if(theWolf.getHealth() + event.getDamage() <= theWolf.getMaxHealth())
|
|
||||||
theWolf.setHealth(theWolf.getHealth()+event.getDamage());
|
|
||||||
else
|
|
||||||
theWolf.setHealth(theWolf.getMaxHealth());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sharpened Claws
|
//Sharpened Claws
|
||||||
if(PPo.getSkillLevel(SkillType.TAMING) >= 750)
|
Taming.sharpenedClaws(PPo, event);
|
||||||
{
|
|
||||||
event.setDamage(event.getDamage() + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Gore
|
//Gore
|
||||||
if(Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING))
|
Taming.gore(PPo, event, master, pluginx);
|
||||||
{
|
|
||||||
event.setDamage(event.getDamage() * 2);
|
//Reward XP
|
||||||
|
Taming.rewardXp(event, pluginx, master);
|
||||||
if(event.getEntity() instanceof Player)
|
|
||||||
{
|
|
||||||
Player target = (Player)event.getEntity();
|
|
||||||
target.sendMessage(mcLocale.getString("Combat.StruckByGore")); //$NON-NLS-1$
|
|
||||||
Users.getProfile(target).setBleedTicks(2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pluginx.misc.addToBleedQue((LivingEntity) event.getEntity());
|
|
||||||
|
|
||||||
master.sendMessage(mcLocale.getString("Combat.Gore")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
if(!event.getEntity().isDead() && !pluginx.misc.mobSpawnerList.contains(event.getEntity().getEntityId()))
|
|
||||||
{
|
|
||||||
int xp = getXp(event.getEntity(), event);
|
|
||||||
Users.getProfile(master).addXP(SkillType.TAMING, xp*10, master);
|
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player)
|
|
||||||
{
|
|
||||||
xp = (event.getDamage() * 2);
|
|
||||||
Users.getProfile(master).addXP(SkillType.TAMING, (int)((xp*10)*1.5), master);
|
|
||||||
}
|
|
||||||
Skills.XpCheckSkill(SkillType.TAMING, master);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Another offensive check for Archery
|
//Another offensive check for Archery
|
||||||
if(event instanceof EntityDamageByEntityEvent && event.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow)
|
if(event instanceof EntityDamageByEntityEvent && event.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow)
|
||||||
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
||||||
|
@ -18,12 +18,82 @@ package com.gmail.nossr50.skills;
|
|||||||
|
|
||||||
import org.bukkit.entity.AnimalTamer;
|
import org.bukkit.entity.AnimalTamer;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.Combat;
|
||||||
|
import com.gmail.nossr50.Users;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
|
import com.gmail.nossr50.datatypes.SkillType;
|
||||||
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
|
|
||||||
public class Taming
|
public class Taming
|
||||||
{
|
{
|
||||||
|
public static void rewardXp(EntityDamageEvent event, mcMMO pluginx, Player master)
|
||||||
|
{
|
||||||
|
if(!event.getEntity().isDead() && !pluginx.misc.mobSpawnerList.contains(event.getEntity().getEntityId()))
|
||||||
|
{
|
||||||
|
int xp = Combat.getXp(event.getEntity(), event);
|
||||||
|
Users.getProfile(master).addXP(SkillType.TAMING, xp*10, master);
|
||||||
|
|
||||||
|
if(event.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
|
xp = (event.getDamage() * 2);
|
||||||
|
Users.getProfile(master).addXP(SkillType.TAMING, (int)((xp*10)*1.5), master);
|
||||||
|
}
|
||||||
|
Skills.XpCheckSkill(SkillType.TAMING, master);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fastFoodService(PlayerProfile PPo, Wolf theWolf, EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
//Fast Food Service
|
||||||
|
if(PPo.getSkillLevel(SkillType.TAMING) >= 50)
|
||||||
|
{
|
||||||
|
if(theWolf.getHealth() < theWolf.getMaxHealth())
|
||||||
|
{
|
||||||
|
if(Math.random() * 10 > 5)
|
||||||
|
{
|
||||||
|
if(theWolf.getHealth() + event.getDamage() <= theWolf.getMaxHealth())
|
||||||
|
theWolf.setHealth(theWolf.getHealth()+event.getDamage());
|
||||||
|
else
|
||||||
|
theWolf.setHealth(theWolf.getMaxHealth());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sharpenedClaws(PlayerProfile PPo, EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
if(PPo.getSkillLevel(SkillType.TAMING) >= 750)
|
||||||
|
{
|
||||||
|
event.setDamage(event.getDamage() + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void gore(PlayerProfile PPo, EntityDamageEvent event, Player master, mcMMO pluginx)
|
||||||
|
{
|
||||||
|
if(Math.random() * 1000 <= PPo.getSkillLevel(SkillType.TAMING))
|
||||||
|
{
|
||||||
|
event.setDamage(event.getDamage() * 2);
|
||||||
|
|
||||||
|
if(event.getEntity() instanceof Player)
|
||||||
|
{
|
||||||
|
Player target = (Player)event.getEntity();
|
||||||
|
target.sendMessage(mcLocale.getString("Combat.StruckByGore")); //$NON-NLS-1$
|
||||||
|
Users.getProfile(target).setBleedTicks(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pluginx.misc.addToBleedQue((LivingEntity) event.getEntity());
|
||||||
|
|
||||||
|
master.sendMessage(mcLocale.getString("Combat.Gore")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean ownerOnline(Wolf theWolf, Plugin pluginx)
|
public static boolean ownerOnline(Wolf theWolf, Plugin pluginx)
|
||||||
{
|
{
|
||||||
for(Player x : pluginx.getServer().getOnlinePlayers())
|
for(Player x : pluginx.getServer().getOnlinePlayers())
|
||||||
|
Loading…
Reference in New Issue
Block a user