diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index 658bd5f..68974f4 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/sig/plugin/TwosideKeeper/CustomDamage.java b/src/sig/plugin/TwosideKeeper/CustomDamage.java index 218ed34..eaed429 100644 --- a/src/sig/plugin/TwosideKeeper/CustomDamage.java +++ b/src/sig/plugin/TwosideKeeper/CustomDamage.java @@ -94,6 +94,7 @@ import sig.plugin.TwosideKeeper.Monster.HellfireGhast; import sig.plugin.TwosideKeeper.Monster.HellfireSpider; import sig.plugin.TwosideKeeper.Monster.Knight; import sig.plugin.TwosideKeeper.Monster.SniperSkeleton; +import sig.plugin.TwosideKeeper.PlayerStructures.DefenderStance; public class CustomDamage { @@ -723,7 +724,7 @@ public class CustomDamage { Player p = (Player)target; PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (PlayerMode.isDefender(p)) { - GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4); + //GenericFunctions.addStackingPotionEffect(p, PotionEffectType.DAMAGE_RESISTANCE, 20*5, 4); if (p.isBlocking() && ItemSet.hasFullSet(p, ItemSet.SONGSTEEL)) { ApplyVendettaStackTimer(pd); pd.vendetta_amt+=((1-CalculateDamageReduction(1,target,damager))*pd.lastrawdamage)*0.40; @@ -771,6 +772,7 @@ public class CustomDamage { restoreHealthToPartyMembersWithProtectorSet(p); applySustenanceSetonHitEffects(p); reduceStrengthAmountForStealthSet(p); + increaseBlockStacks(p); if (!isFlagSet(flags,NOAOE)) { if (damage nearbyentities = getNearbyMobs(l,range); for (LivingEntity ent : nearbyentities) { boolean allowed=true; diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java index 5b79e55..7a0c9de 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/ItemSet.java @@ -26,7 +26,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils; public enum ItemSet { PANROS(1,1, 6,4, 10,10, 20,10, 1,6,10,20), - SONGSTEEL(4,2, 6,2, 8,8, 20,10, 4, 6, 8, 20), + SONGSTEEL(50,50, 6,2, 8,8, 20,10, 4, 6, 8, 20), DAWNTRACKER(2,2, 20,10, 10,5, 10,5, 2, 20, 10, 10), LORASYS(2,2, 0,0, 0,0, 0,0, 2, 0, 0, 0), JAMDAK(3,3, 5,1, 10,1, 10,2, 3, 5, 10, 10), //Graceful Dodge is in ticks. @@ -421,7 +421,7 @@ public enum ItemSet { case SONGSTEEL:{ lore.add(ChatColor.LIGHT_PURPLE+"Defender Gear"); lore.add(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+" Songsteel Set"); - lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Block Chance"); + lore.add(ChatColor.YELLOW+"+"+ItemSet.GetBaseAmount(set, tier, 1, p)+"% Threat Increase"); }break; case DAWNTRACKER:{ lore.add(ChatColor.LIGHT_PURPLE+"Barbarian Gear"); diff --git a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ColoredParticle.java b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ColoredParticle.java index 0405017..8d5b45f 100644 --- a/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ColoredParticle.java +++ b/src/sig/plugin/TwosideKeeper/HelperStructures/Utils/Classes/ColoredParticle.java @@ -14,10 +14,10 @@ public enum ColoredParticle { } String name; public void send(Location location, List players, int r, int g, int b) { - ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, players); + ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, players); } public void send(Location location, int Distance, int r, int g, int b) { - ParticleEffect.valueOf(name).display(r/255, g / 255, b / 255, 1, 0, location, Distance); + ParticleEffect.valueOf(name).display(r/255f, g / 255f, b / 255f, 1, 0, location, Distance); } } \ No newline at end of file diff --git a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java index fab33ae..250949e 100644 --- a/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java +++ b/src/sig/plugin/TwosideKeeper/LivingEntityStructure.java @@ -17,6 +17,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason; import org.inventivetalent.glow.GlowAPI; import sig.plugin.TwosideKeeper.HelperStructures.Channel; +import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils; @@ -406,8 +407,19 @@ public class LivingEntityStructure { } public void increaseAggro(LivingEntity target, int amt) { + amt = getNewAggroBasedOnAggroMultipliers(target,amt); setAggro(target,getAggroRating(target)+amt); } + private int getNewAggroBasedOnAggroMultipliers(LivingEntity target, int amt) { + if (target instanceof Player) { + Player p = (Player)target; + amt = amt * ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL); + if (ItemSet.hasFullSet(p, ItemSet.PRIDE)) { + return amt * ItemSet.getHighestTierInSet(p, ItemSet.PRIDE); + } + } + return amt; + } public void decreaseAggro(LivingEntity target, int amt) { increaseAggro(target,-amt); } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructure.java b/src/sig/plugin/TwosideKeeper/PlayerStructure.java index e3327e2..1dcc336 100644 --- a/src/sig/plugin/TwosideKeeper/PlayerStructure.java +++ b/src/sig/plugin/TwosideKeeper/PlayerStructure.java @@ -180,6 +180,8 @@ public class PlayerStructure { public boolean firstPVPMatch=true; public String lastPVPHitReason=""; public double lastPVPHitDamage=0; + public boolean blocking=false; + public long lastShieldCharge=0; /*State 1 * 1: Best of 3 Rounds * 2: Best of 5 Rounds @@ -282,6 +284,7 @@ public class PlayerStructure { public int unafkLength = 0; public int gracePeriod = 0; public long lastActiveActivity = 0; //Includes disenchanting / alchemizing. + public int blockStacks = 0; //Prevent Automatic AFK moving the camera just to avoid the system. public long lastAdjustmentReading = 0; //When the last adjustment reading started. @@ -815,4 +818,8 @@ public class PlayerStructure { mult += Math.max(Math.min(Math.pow(pd.actionRecords/10, 1.05)-1,1000),0); return mult; } + + public boolean isBlocking() { + return blocking; + } } diff --git a/src/sig/plugin/TwosideKeeper/PlayerStructures/DefenderStance.java b/src/sig/plugin/TwosideKeeper/PlayerStructures/DefenderStance.java new file mode 100644 index 0000000..415e176 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/PlayerStructures/DefenderStance.java @@ -0,0 +1,43 @@ +package sig.plugin.TwosideKeeper.PlayerStructures; + +import org.bukkit.entity.Player; + +import sig.plugin.TwosideKeeper.PlayerStructure; +import sig.plugin.TwosideKeeper.TwosideKeeper; +import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; +import sig.plugin.TwosideKeeper.HelperStructures.Utils.DebugUtils; + +public enum DefenderStance { + AGGRESSION("Aggressive",false,false), //0 + BLOCK("Block",true,false), //2 + CHARGE("Charge",false,true), //1 + TANK("Tank",true,true); //3 + + String name; + boolean block; + boolean sneak; + + DefenderStance(String realname, boolean requiresBlock, boolean requiresSneak) { + this.name = realname; + this.block = requiresBlock; + this.sneak = requiresSneak; + } + + public static DefenderStance getDefenderStance(Player p) { + if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + for (DefenderStance check : DefenderStance.values()) { + if (p.isSneaking()==check.sneak && pd.isBlocking()==check.block) { + return check; + } + } + TwosideKeeper.log("WARNING! We could not find a stance for Player "+p.getName()+"! None of the states match!", 1); + DebugUtils.showStackTrace(); + return null; + } else { + TwosideKeeper.log("WARNING! We could not find a stance for Player "+p.getName()+"! They are not a Defender! You should probably remove this call.", 1); + DebugUtils.showStackTrace(); + return null; + } + } +} diff --git a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java index edbaaed..fdc8b05 100644 --- a/src/sig/plugin/TwosideKeeper/TwosideKeeper.java +++ b/src/sig/plugin/TwosideKeeper/TwosideKeeper.java @@ -298,6 +298,7 @@ import sig.plugin.TwosideKeeper.Monster.HellfireGhast; import sig.plugin.TwosideKeeper.Monster.Knight; import sig.plugin.TwosideKeeper.Monster.MonsterTemplate; import sig.plugin.TwosideKeeper.Monster.SniperSkeleton; +import sig.plugin.TwosideKeeper.PlayerStructures.DefenderStance; import sig.plugin.TwosideKeeper.Rooms.DPSChallengeRoom; import sig.plugin.TwosideKeeper.Rooms.ParkourChallengeRoom; import sig.plugin.TwosideKeeper.Rooms.TankChallengeRoom; @@ -4399,7 +4400,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener { LinkPlayerToOtherPlayer(p,pl); } } - aggroMonsters(p,pd,1000,16); + if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) { + pd.blocking=true; + } } private void LinkPlayerToOtherPlayer(Player p, Player pl) { @@ -4473,6 +4476,28 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } },1); + if (ev.getAction() == Action.LEFT_CLICK_AIR || ev.getAction() == Action.LEFT_CLICK_BLOCK) { + //PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (pd.lastShieldCharge+(20*1)<=TwosideKeeper.getServerTickTime()) { + if (PlayerMode.getPlayerMode(p) == PlayerMode.DEFENDER && + DefenderStance.getDefenderStance(p)==DefenderStance.CHARGE) { + SoundUtils.playGlobalSound(p.getLocation(), Sound.BLOCK_GLASS_PLACE, 1f, 1.25f); + p.setVelocity(p.getLocation().getDirection().multiply(2)); + pd.lastShieldCharge = TwosideKeeper.getServerTickTime(); + Vector dir = p.getLocation().getDirection(); + for (int i=0;i<10;i++) { + Vector newdir = dir.clone(); + newdir.multiply(i); + Location checkpos = p.getLocation().add(newdir); + /*double dmg = CustomDamage.CalculateDamage(0,p,); + CustomDamage.ApplyDamage(, damager, target, weapon, reason, flags)*/ + //GenericFunctions.DealBlitzenLightningStrikeToNearbyMobs(l, basedmg, range, damager, flags); + GenericFunctions.DealDamageToNearbyMobs(checkpos, 0, 1, true, 2, p, p.getEquipment().getItemInMainHand(), false, "Shield Charge"); + } + } + } + } + if (!Christmas.RunPlayerInteractEvent(ev)) {return;} if (ev.getClickedBlock()!=null && ev.getClickedBlock().getType()==Material.CHEST && @@ -4768,21 +4793,17 @@ public class TwosideKeeper extends JavaPlugin implements Listener { //Shield related stuff in here. //TwosideKeeper.log(ev.useInteractedBlock().toString(), 0); - if ((ev.getAction()==Action.RIGHT_CLICK_AIR || + /*if ((ev.getAction()==Action.RIGHT_CLICK_AIR || ev.getAction()==Action.RIGHT_CLICK_BLOCK) && (ev.getClickedBlock()==null || !BlockUtils.isInteractable(ev.getClickedBlock()))) { if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) { aggroMonsters(p, pd, 1000, 16); } //See if this player is blocking. If so, give them absorption. //Player p = ev.getPlayer(); - /*Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - @Override - public void run() { - if (p.isBlocking()) { - //Give absorption hearts. - } - } - },8);*/ + }*/ + if ((ev.getAction()==Action.RIGHT_CLICK_AIR || + ev.getAction()==Action.RIGHT_CLICK_BLOCK) && (ev.getClickedBlock()==null || !BlockUtils.isInteractable(ev.getClickedBlock()))) { + pd.blocking=true; } //Check if we're allowed to open a shop chest. @@ -5464,7 +5485,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener { } private void aggroMonsters(final Player p, PlayerStructure pd, int tauntAmt, int range) { if (PlayerMode.isDefender(p)) { - GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.ABSORPTION,200,1,p); List entities = p.getNearbyEntities(range, range, range); for (int i=0;i"); } @@ -408,6 +414,47 @@ final public class runServerHeartbeat implements Runnable { TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime(); } + private void increaseAggroTowardsTarget(Player p) { + if (PlayerMode.getPlayerMode(p)==PlayerMode.DEFENDER) { + if (DefenderStance.getDefenderStance(p)==DefenderStance.BLOCK) { + LivingEntity target = aPlugin.API.rayTraceTargetEntity(p, 20); + if (target!=null && !(target instanceof Player)) { + LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(target); + les.increaseAggro(p, 100); + les.lastHit = TwosideKeeper.getServerTickTime(); + //TwosideKeeper.log(les.displayAggroTable(), 0); + Vector dir = MovementUtils.pointTowardsLocation(target.getLocation(), p.getLocation()); + for (int i=0;ip.getMaxHealth()) { + CustomDamage.setAbsorptionHearts(p, (float)p.getMaxHealth()); + } + } + + private void UpdatePlayerBlockStatus(Player p) { + PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); + if (!p.isBlocking() && pd.blocking) { + pd.blocking=p.isBlocking(); + } + } + private void CheckPlayerLocationAndActionQueue(Player p) { PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); if (pd.leashedLoc==null) { @@ -960,6 +1007,9 @@ final public class runServerHeartbeat implements Runnable { pd.lastattacked=0; pd.lifestealstacks=0; } + if (pd.lastcombat+(20*60)