2012-01-09 20:00:13 +01:00
|
|
|
/*
|
|
|
|
This file is part of mcMMO.
|
|
|
|
|
|
|
|
mcMMO is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
mcMMO is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package com.gmail.nossr50.skills;
|
|
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
2012-02-27 23:28:32 +01:00
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
2012-01-09 20:00:13 +01:00
|
|
|
import com.gmail.nossr50.Users;
|
2012-02-27 23:28:32 +01:00
|
|
|
import com.gmail.nossr50.m;
|
2012-01-09 20:00:13 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
|
|
|
import com.gmail.nossr50.datatypes.SkillType;
|
|
|
|
import com.gmail.nossr50.locale.mcLocale;
|
|
|
|
import com.gmail.nossr50.party.Party;
|
|
|
|
|
|
|
|
public class Archery
|
|
|
|
{
|
2012-02-24 03:13:06 +01:00
|
|
|
public static void trackArrows(mcMMO pluginx, Entity x, PlayerProfile PPa)
|
2012-01-09 20:00:13 +01:00
|
|
|
{
|
2012-02-24 03:13:06 +01:00
|
|
|
int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY);
|
|
|
|
if(!pluginx.misc.arrowTracker.containsKey(x))
|
2012-01-09 20:00:13 +01:00
|
|
|
pluginx.misc.arrowTracker.put(x, 0);
|
2012-02-24 03:13:06 +01:00
|
|
|
if(skillLevel > 1000 || (Math.random() * 1000 <= skillLevel))
|
|
|
|
pluginx.misc.arrowTracker.put(x, 1);
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
2012-02-24 03:13:06 +01:00
|
|
|
|
|
|
|
public static void ignitionCheck(Entity x, Player attacker)
|
2012-01-09 20:00:13 +01:00
|
|
|
{
|
|
|
|
//Check to see if PVP for this world is disabled before executing
|
|
|
|
if(!x.getWorld().getPVP())
|
|
|
|
return;
|
|
|
|
|
|
|
|
PlayerProfile PPa = Users.getProfile(attacker);
|
|
|
|
if(Math.random() * 100 >= 75)
|
|
|
|
{
|
2012-02-23 15:03:49 +01:00
|
|
|
int ignition = 20;
|
|
|
|
ignition += (PPa.getSkillLevel(SkillType.ARCHERY)/200)*20;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
2012-02-23 15:03:49 +01:00
|
|
|
if(ignition > 120)
|
|
|
|
ignition = 120;
|
2012-01-09 20:00:13 +01:00
|
|
|
|
|
|
|
if(x instanceof Player)
|
|
|
|
{
|
2012-02-24 03:13:06 +01:00
|
|
|
Player defender = (Player)x;
|
|
|
|
if(!Party.getInstance().inSameParty(attacker, defender))
|
2012-01-09 20:00:13 +01:00
|
|
|
{
|
2012-02-24 03:13:06 +01:00
|
|
|
defender.setFireTicks(ignition);
|
2012-01-09 20:00:13 +01:00
|
|
|
attacker.sendMessage(mcLocale.getString("Combat.Ignition")); //$NON-NLS-1$
|
2012-02-24 03:13:06 +01:00
|
|
|
defender.sendMessage(mcLocale.getString("Combat.BurningArrowHit")); //$NON-NLS-1$
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
2012-02-24 03:13:06 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x.setFireTicks(ignition);
|
|
|
|
attacker.sendMessage(mcLocale.getString("Combat.Ignition")); //$NON-NLS-1$
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-24 03:13:06 +01:00
|
|
|
|
2012-01-09 20:00:13 +01:00
|
|
|
public static void dazeCheck(Player defender, Player attacker)
|
|
|
|
{
|
2012-02-24 03:13:06 +01:00
|
|
|
int skillLevel = Users.getProfile(attacker).getSkillLevel(SkillType.ARCHERY);
|
2012-01-09 20:00:13 +01:00
|
|
|
|
|
|
|
Location loc = defender.getLocation();
|
|
|
|
if(Math.random() * 10 > 5)
|
2012-02-24 03:13:06 +01:00
|
|
|
loc.setPitch(90);
|
|
|
|
else
|
2012-01-09 20:00:13 +01:00
|
|
|
loc.setPitch(-90);
|
2012-02-24 03:13:06 +01:00
|
|
|
|
|
|
|
if(skillLevel >= 1000)
|
|
|
|
{
|
|
|
|
if(Math.random() * 1000 <= 500)
|
|
|
|
{
|
2012-01-09 20:00:13 +01:00
|
|
|
defender.teleport(loc);
|
|
|
|
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$
|
|
|
|
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
}
|
2012-02-24 03:13:06 +01:00
|
|
|
}
|
|
|
|
else if(Math.random() * 2000 <= skillLevel)
|
|
|
|
{
|
2012-01-09 20:00:13 +01:00
|
|
|
defender.teleport(loc);
|
|
|
|
defender.sendMessage(mcLocale.getString("Combat.TouchedFuzzy")); //$NON-NLS-1$
|
|
|
|
attacker.sendMessage(mcLocale.getString("Combat.TargetDazed")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
|
|
}
|
|
|
|
}
|
2012-02-27 23:28:32 +01:00
|
|
|
|
|
|
|
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin)
|
|
|
|
{
|
|
|
|
if(plugin.misc.arrowTracker.containsKey(entity))
|
|
|
|
{
|
|
|
|
Integer x = 0;
|
|
|
|
while(x < plugin.misc.arrowTracker.get(entity))
|
|
|
|
{
|
|
|
|
m.mcDropItem(entity.getLocation(), new ItemStack(262, 1));
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
plugin.misc.arrowTracker.remove(entity);
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|