mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +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)
|
||||
{
|
||||
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent) event;
|
||||
Wolf theWolf = (Wolf) eventb.getDamager();
|
||||
|
||||
if(theWolf.isTamed() && Taming.ownerOnline(theWolf, pluginx))
|
||||
{
|
||||
if(Taming.getOwner(theWolf, pluginx) == null)
|
||||
return;
|
||||
|
||||
Player master = Taming.getOwner(theWolf, pluginx);
|
||||
PlayerProfile PPo = Users.getProfile(master);
|
||||
|
||||
if(mcPermissions.getInstance().taming(master))
|
||||
{
|
||||
//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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Taming.fastFoodService(PPo, theWolf, event);
|
||||
|
||||
//Sharpened Claws
|
||||
if(PPo.getSkillLevel(SkillType.TAMING) >= 750)
|
||||
{
|
||||
event.setDamage(event.getDamage() + 2);
|
||||
}
|
||||
Taming.sharpenedClaws(PPo, event);
|
||||
|
||||
//Gore
|
||||
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$
|
||||
}
|
||||
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);
|
||||
}
|
||||
Taming.gore(PPo, event, master, pluginx);
|
||||
|
||||
//Reward XP
|
||||
Taming.rewardXp(event, pluginx, master);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Another offensive check for Archery
|
||||
if(event instanceof EntityDamageByEntityEvent && event.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent) event).getDamager() instanceof Arrow)
|
||||
archeryCheck((EntityDamageByEntityEvent)event, pluginx);
|
||||
|
@ -18,12 +18,82 @@ package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
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 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)
|
||||
{
|
||||
for(Player x : pluginx.getServer().getOnlinePlayers())
|
||||
|
Loading…
Reference in New Issue
Block a user