Another WIP update for 0.9

This commit is contained in:
nossr50 2011-03-14 06:25:59 -07:00
parent 3812ef5bb5
commit c83ef55714
7 changed files with 157 additions and 75 deletions

View File

@ -46,8 +46,6 @@ public class mcCombat {
return; return;
} }
} }
if(defender != null)
mcUsers.getProfile(defender).setRecentlyHurt(30);
/* /*
* AXE CRITICAL CHECK * AXE CRITICAL CHECK
*/ */
@ -498,6 +496,29 @@ public class mcCombat {
public int calculateDamage(EntityDamageEvent event, int dmg){ public int calculateDamage(EntityDamageEvent event, int dmg){
return event.getDamage() + dmg; return event.getDamage() + dmg;
} }
public void applyAoeDamage(Player attacker, EntityDamageByEntityEvent event, Entity x){
for(Entity derp : x.getWorld().getEntities()){
if(mcm.getInstance().getDistance(x.getLocation(), derp.getLocation()) < 5){
if(derp instanceof Player){
Player target = (Player)derp;
if(mcParty.getInstance().inSameParty(attacker, target))
continue;
if(!target.getName().equals(attacker.getName())){
target.damage(event.getDamage() / 2);
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
}
}
if(derp instanceof Monster){
Monster target = (Monster)derp;
target.damage(event.getDamage() / 2);
}
if(derp instanceof Animals){
Animals target = (Animals)derp;
target.damage(event.getDamage() / 2);
}
}
}
}
public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){ public void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Entity x){
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
if(mcUsers.getProfile(attacker).getAxesInt() >= 750){ if(mcUsers.getProfile(attacker).getAxesInt() >= 750){

View File

@ -69,6 +69,11 @@ public class mcEntityListener extends EntityListener {
EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event; EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event;
Entity e = eventb.getEntity(); //Defender Entity e = eventb.getEntity(); //Defender
Entity f = eventb.getDamager(); //Attacker Entity f = eventb.getDamager(); //Attacker
/*
* CHECK FOR PVP INTERACTIONS
*/
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true);
/* /*
* IF DEFENDER IS PLAYER * IF DEFENDER IS PLAYER
*/ */
@ -88,6 +93,8 @@ public class mcEntityListener extends EntityListener {
//((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!"); //((Player) f).sendMessage("DEBUG: EntityDamageByEntity cast correctly!");
int typeid = ((Player) f).getItemInHand().getTypeId(); int typeid = ((Player) f).getItemInHand().getTypeId();
Player attacker = (Player)f; Player attacker = (Player)f;
if(mcUsers.getProfile(attacker).getAxePreparationMode())
mcSkills.getInstance().skullSplitterCheck(attacker);
/* /*
* Player versus Monster checks, this handles all skill damage modifiers and any procs. * Player versus Monster checks, this handles all skill damage modifiers and any procs.
*/ */
@ -105,12 +112,13 @@ public class mcEntityListener extends EntityListener {
* Player versus Animals checks, these checks handle any skill modifiers or procs * Player versus Animals checks, these checks handle any skill modifiers or procs
*/ */
mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid); mcCombat.getInstance().playerVersusAnimalsChecks(e, attacker, eventb, typeid);
/*
* This will do AOE damage from the axes ability
*/
if(!event.isCancelled() && mcUsers.getProfile(attacker).getSkullSplitterMode())
mcCombat.getInstance().applyAoeDamage(attacker, eventb, x);
} }
/*
* CHECK FOR PVP INTERACTIONS
*/
if(f instanceof Player && e instanceof Player && !mcLoadProperties.pvp)
event.setCancelled(true);
if(e instanceof Monster || e instanceof Animals){ if(e instanceof Monster || e instanceof Animals){
if(e instanceof Monster){ if(e instanceof Monster){
Monster monster = (Monster)e; Monster monster = (Monster)e;

View File

@ -153,6 +153,7 @@ public class mcMining {
} }
} }
public void SuperBreakerBlockCheck(Player player, Block block){ public void SuperBreakerBlockCheck(Player player, Block block){
player.getItemInHand().setDurability((short) (player.getItemInHand().getDurability() + 1));
Location loc = block.getLocation(); Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
byte damage = 0; byte damage = 0;

View File

@ -37,6 +37,13 @@ public class mcPermissions {
return true; return true;
} }
} }
public boolean unarmedAbility(Player player){
if (permissionsEnabled) {
return permission(player, "mcmmo.ability.unarmed");
} else {
return true;
}
}
public boolean chimaeraWing(Player player){ public boolean chimaeraWing(Player player){
if (permissionsEnabled) { if (permissionsEnabled) {
return permission(player, "mcmmo.item.chimaerawing"); return permission(player, "mcmmo.item.chimaerawing");

View File

@ -53,6 +53,12 @@ public class mcSkills {
player.sendMessage(ChatColor.GREEN+"Your Serrated Strikes ability is refreshed!"); player.sendMessage(ChatColor.GREEN+"Your Serrated Strikes ability is refreshed!");
} }
} }
if(mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){
mcUsers.getProfile(player).decreaseSkullSplitterCooldown();
if(mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"Your Skull Splitter ability is refreshed!");
}
}
} }
public void axeActivationCheck(Player player, Block block){ public void axeActivationCheck(Player player, Block block){
if(mcPermissions.getInstance().axes(player) && mcPermissions.getInstance().woodcutting(player)){ if(mcPermissions.getInstance().axes(player) && mcPermissions.getInstance().woodcutting(player)){
@ -65,7 +71,7 @@ public class mcSkills {
mcWoodCutting.getInstance().treeFellerCheck(player, block); mcWoodCutting.getInstance().treeFellerCheck(player, block);
} else if (mcPermissions.getInstance().axes(player)){ } else if (mcPermissions.getInstance().axes(player)){
/* /*
* PUT CODE RELATED TO ACTIVATING THE AXE MODE HERE *
*/ */
} }
} }
@ -73,6 +79,44 @@ public class mcSkills {
if(mcPermissions.getInstance().miningability(player)){ if(mcPermissions.getInstance().miningability(player)){
mcMining.getInstance().superBreakerCheck(player, block); mcMining.getInstance().superBreakerCheck(player, block);
} }
axeActivationCheck(player, block);
}
public void skullSplitterCheck(Player player){
if(mcm.getInstance().isAxes(player.getItemInHand())){
/*
* CHECK FOR AXE PREP MODE
*/
if(mcUsers.getProfile(player).getAxePreparationMode()){
mcUsers.getProfile(player).setAxePreparationMode(false);
mcUsers.getProfile(player).setAxePreparationTicks(0);
}
int ticks = 3;
if(mcUsers.getProfile(player).getAxesInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 750)
ticks++;
if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() == 0){
player.sendMessage(ChatColor.GREEN+"**SKULL SPLITTER ACTIVATED**");
mcUsers.getProfile(player).setSkullSplitterTicks(ticks);
mcUsers.getProfile(player).setSkullSplitterMode(true);
}
if(!mcUsers.getProfile(player).getSkullSplitterMode() && mcUsers.getProfile(player).getSkullSplitterCooldown() >= 1){
player.sendMessage(ChatColor.RED+"You are too tired to use that ability again.");
}
}
} }
public void monitorSkills(Player player){ public void monitorSkills(Player player){
/* /*
@ -88,6 +132,20 @@ public class mcSkills {
} }
} }
} }
/*
* AXES ABILITY
*/
if(mcPermissions.getInstance().axesAbility(player)){
//Monitor the length of TreeFeller mode
if(mcUsers.getProfile(player).getSkullSplitterMode()){
mcUsers.getProfile(player).decreaseSkullSplitterTicks();
if(mcUsers.getProfile(player).getSkullSplitterTicks() <= 0){
mcUsers.getProfile(player).setSkullSplitterMode(false);
mcUsers.getProfile(player).setSkullSplitterCooldown(120);
player.sendMessage(ChatColor.GRAY+"**You feel strength leaving you**");
}
}
}
/* /*
* WOODCUTTING ABILITY * WOODCUTTING ABILITY
*/ */

View File

@ -156,9 +156,9 @@ class PlayerList
protected final Logger log = Logger.getLogger("Minecraft"); protected final Logger log = Logger.getLogger("Minecraft");
private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation, private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather; archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
private boolean dead, treeFellerMode, superbreakermode, serratedStrikesMode, axePreparationMode; private boolean dead, treeFellerMode, superbreakermode, serratedStrikesMode, axePreparationMode, skullSplitterMode;
private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0, private int recentlyhurt = 0, bleedticks = 0, superbreakerticks = 0, superbreakercooldown = 0,
serratedStrikesTicks = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0, serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0,
axePreparationTicks = 0; axePreparationTicks = 0;
Player thisplayer; Player thisplayer;
char defaultColor; char defaultColor;
@ -462,6 +462,37 @@ class PlayerList
axePreparationTicks--; axePreparationTicks--;
} }
} }
/*
* SKULL SPLITTER
*/
public boolean getSkullSplitterMode(){
return skullSplitterMode;
}
public void setSkullSplitterMode(Boolean bool){
skullSplitterMode = bool;
}
public Integer getSkullSplitterTicks(){
return skullSplitterTicks;
}
public void setSkullSplitterTicks(Integer newvalue){
skullSplitterTicks = newvalue;
}
public void decreaseSkullSplitterTicks(){
if(skullSplitterTicks >= 1){
skullSplitterTicks--;
}
}
public void setSkullSplitterCooldown(Integer newvalue){
skullSplitterCooldown = newvalue;
}
public int getSkullSplitterCooldown(){
return skullSplitterCooldown;
}
public void decreaseSkullSplitterCooldown(){
if(skullSplitterCooldown >= 1){
skullSplitterCooldown--;
}
}
/* /*
* SERRATED STRIKES * SERRATED STRIKES
*/ */

View File

@ -30,7 +30,7 @@ public class mcm {
} }
return instance; return instance;
} }
public static double getDistance(Location loca, Location locb) public double getDistance(Location loca, Location locb)
{ {
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2) return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
+ Math.pow(loca.getZ() - locb.getZ(), 2)); + Math.pow(loca.getZ() - locb.getZ(), 2));
@ -137,70 +137,6 @@ public class mcm {
} }
return true; return true;
} }
public void simulateNaturalDrops(Entity entity){
Location loc = entity.getLocation();
if(entity instanceof Pig){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 319); //BACON
}
mcDropItem(loc, 319);
}
}
if(entity instanceof Spider){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 287); //SILK
}
mcDropItem(loc, 287);
}
}
if(entity instanceof Skeleton){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 262); //ARROWS
}
mcDropItem(loc, 262);
}
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 352); //BONES
}
mcDropItem(loc, 352);
}
}
if(entity instanceof Zombie){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 288); //FEATHERS
}
mcDropItem(loc, 288);
}
}
if(entity instanceof Cow){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 334); //LEATHER
}
if(Math.random() * 2 > 1){
mcDropItem(loc, 334);
}
mcDropItem(loc, 334);
}
}
if(entity instanceof Squid){
if(Math.random() * 3 > 2){
if(Math.random() * 2 > 1){
mcDropItem(loc, 351); //INK SACS
}
if(Math.random() * 2 > 1){
mcDropItem(loc, 351);
}
mcDropItem(loc, 351);
}
}
mcSkills.getInstance().arrowRetrievalCheck(entity);
}
public void mcDropItem(Location loc, int id){ public void mcDropItem(Location loc, int id){
if(loc != null){ if(loc != null){
Material mat = Material.getMaterial(id); Material mat = Material.getMaterial(id);
@ -256,6 +192,7 @@ public class mcm {
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"WOODCUTTING"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Chopping down trees");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Tree Feller (ABILITY): "+ChatColor.GREEN+"Make trees explode");
player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot"); player.sendMessage(ChatColor.DARK_AQUA+"Double Drops: "+ChatColor.YELLOW+ChatColor.GREEN+"Double the normal loot");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%"); player.sendMessage(ChatColor.RED+"Double Drop Chance: "+ChatColor.YELLOW+percentage+"%");
@ -298,9 +235,27 @@ public class mcm {
} else { } else {
percentage = "75"; percentage = "75";
} }
int ticks = 3;
if(mcUsers.getProfile(player).getAxesInt() >= 50)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 150)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 250)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 350)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 450)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 550)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 650)
ticks++;
if(mcUsers.getProfile(player).getAxesInt() >= 750)
ticks++;
player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----"); player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"AXES"+ChatColor.RED+"[]-----");
player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters"); player.sendMessage(ChatColor.DARK_GRAY+"XP GAIN: "+ChatColor.WHITE+"Attacking Monsters");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"EFFECTS"+ChatColor.RED+"[]---");
player.sendMessage(ChatColor.DARK_AQUA+"Skull Splitter (ABILITY): "+ChatColor.GREEN+"Deal AoE Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Critical Strikes: "+ChatColor.GREEN+"Double Damage");
player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage"); player.sendMessage(ChatColor.DARK_AQUA+"Axe Mastery (500 SKILL): "+ChatColor.GREEN+"Modifies Damage");
player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---"); player.sendMessage(ChatColor.RED+"---[]"+ChatColor.GREEN+"YOUR STATS"+ChatColor.RED+"[]---");
@ -310,6 +265,7 @@ public class mcm {
} else { } else {
player.sendMessage(ChatColor.GREEN+"Axe Mastery - Bonus 4 damage"); player.sendMessage(ChatColor.GREEN+"Axe Mastery - Bonus 4 damage");
} }
player.sendMessage(ChatColor.RED+"Skull Splitter Length: "+ChatColor.YELLOW+(ticks * 2)+"s");
} }
if(split[0].equalsIgnoreCase("/swords")){ if(split[0].equalsIgnoreCase("/swords")){
event.setCancelled(true); event.setCancelled(true);