Fixed a bug with Moonshadow perks. Other modes can use slayer set items,

where applicable.
This commit is contained in:
sigonasr2 2016-09-04 15:27:27 -05:00
parent dfc55b50ef
commit 325987d401
7 changed files with 68 additions and 46 deletions

Binary file not shown.

View File

@ -363,6 +363,7 @@ public class CustomDamage {
GenericFunctions.removeStealth(p);
}
pd.slayermegahit=false;
pd.lastcombat=TwosideKeeper.getServerTickTime();
if (GenericFunctions.AttemptRevive(p, damage, reason)) {
damage=0;
@ -458,18 +459,19 @@ public class CustomDamage {
subtractWeaponDurability(p,weapon);
aPlugin.API.showDamage(target, GetHeartAmount(damage));
pd.slayermegahit=false;
pd.lastcombat=TwosideKeeper.getServerTickTime();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (isFlagSet(pd.lasthitproperties,IS_CRIT)) {
GenericFunctions.addSuppressionTime(target, 15);
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2)) {
int poisonlv = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2, 2);
if (target.hasPotionEffect(PotionEffectType.BLINDNESS) && GenericFunctions.getPotionEffectLevel(PotionEffectType.BLINDNESS, target)<=poisonlv) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target);
} else {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target, true);
}
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2)) {
int poisonlv = (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 2, 2);
if (target.hasPotionEffect(PotionEffectType.BLINDNESS) && GenericFunctions.getPotionEffectLevel(PotionEffectType.BLINDNESS, target)<=poisonlv) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target);
} else {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.BLINDNESS, 20*15, (int)poisonlv, target, true);
}
}
@ -951,15 +953,13 @@ public class CustomDamage {
}
}
if (PlayerMode.isSlayer(p)) {
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 3, 3)/100d;
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) {
dodgechance+=(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7, 4))); //For every 1m, give 5%.
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7) &&
GenericFunctions.hasStealth(p)) {
dodgechance+=0.4;
}
dodgechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 3, 3)/100d;
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7)) {
dodgechance+=(93.182445*pd.velocity)*(0.05+(0.01*ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN, 7, 4))); //For every 1m, give 5%.
}
if (ItemSet.HasSetBonusBasedOnSetBonusCount(GenericFunctions.getHotbarItems(p), p, ItemSet.MOONSHADOW, 7) &&
GenericFunctions.hasStealth(p)) {
dodgechance+=0.4;
}
if (PlayerMode.isStriker(p) &&

View File

@ -15,6 +15,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
@ -26,6 +27,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.entity.Spider;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@ -3269,13 +3271,12 @@ public class GenericFunctions {
aPlugin.API.discordSendRawItalicized(ChatColor.GOLD+p.getName()+ChatColor.WHITE+" almost died... But came back to life!");
}
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER &&
ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) &&
if (ItemSet.HasSetBonusBasedOnSetBonusCount(hotbar, p, ItemSet.GLADOMAIN, 5) &&
pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN, p)<=TwosideKeeper.getServerTickTime()) {
pd.lastlifesavertime=TwosideKeeper.getServerTickTime();
RevivePlayer(p,p.getMaxHealth());
pd.slayermodehp = p.getMaxHealth();
GenericFunctions.applyStealth(p,false);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {GenericFunctions.applyStealth(p,false);}
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.SPEED, 20*10, 3, p, true);
deAggroNearbyTargets(p);
revived=true;
@ -3991,7 +3992,13 @@ public class GenericFunctions {
LivingEntity target = aPlugin.API.getTargetEntity(player, 100);
if (target!=null) {
//We found a target, try to jump behind them now.
Location teleloc = target.getLocation().add(target.getLocation().getDirection().multiply(-1.0));
double mult = 0.0;
double pitch = 0.0;
if (target instanceof Spider || target instanceof CaveSpider) {
mult += 2.0;
pitch-=1.0;
}
Location teleloc = target.getLocation().add(target.getLocation().getDirection().multiply(-1.0-mult));
int i=0;
while (teleloc.getBlock().getType().isSolid()) {
if (i==0) {
@ -4014,6 +4021,7 @@ public class GenericFunctions {
i++;
}
player.playSound(teleloc, Sound.BLOCK_NOTE_SNARE, 1.0f, 1.0f);
teleloc.setPitch((float)pitch);
player.teleport(teleloc);
Location newfacingdir = target.getLocation().setDirection(target.getLocation().getDirection());
target.teleport(newfacingdir);

View File

@ -58,7 +58,7 @@ public enum PlayerMode {
+ ChatColor.WHITE+"->Players are identified as 'Slayers' by wearing no armor, and wearing a Bauble in their hotbar.\n"
+ ChatColor.GRAY+"->Slayers can make use of up to 9 Baubles by placing them on their hotbar (Ideally you would want to use one slot for a weapon). Each Bauble adds a certain amount of stats to the Slayer, making them more efficient.\n"
+ ChatColor.WHITE+"->Slayers take a maximum of 1 Heart (2 HP) in damage from all attacks, making this mode essentially 5 lives.\n"
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills, using the Amulet's set effect, or sleeping. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
+ ChatColor.GRAY+"->Slayers are not affected by any Health Recovery and Health Regeneration effects. This mode only heals from kills, being out of combat for 1 minute, using the Amulet's set effect, or sleeping. However, Absorption will still work for a Slayer. Absorption hearts just get removed with normal damage calculation rules.\n"
+ ChatColor.WHITE+"->Whenever a Slayer kills a target, they recover 1 Heart (2 HP). This can be modified by a special weapon.\n"
+ ChatColor.GRAY+"->Slayers can enter Stealth mode by pressing Sneak. Once in Stealth mode, Slayers will not leave stealth until they take damage or Sneak again. Stealth mode drains 1 Durability every second from tools on your hotbar.\n"
+ ChatColor.WHITE+"->While in Stealth mode, nothing will be able to detect you. Note this does not get rid of aggression from targets that have already aggro'd you.\n"

View File

@ -258,7 +258,7 @@ public class WorldShop {
Bukkit.getPlayer("sigonasr2").getInventory().addItem(newbanner);
}*/
for (int i=0;i<banner.getPatterns().size();i++) {
String color = GenericFunctions.CapitalizeFirstLetters(banner.getPatterns().get(i).getColor().name());
String color = GenericFunctions.CapitalizeFirstLetters(banner.getPatterns().get(i).getColor().name().replace("_", " "));
String pattern_name = "";
switch (banner.getPatterns().get(i).getPattern()) {
case BORDER:

View File

@ -127,6 +127,7 @@ public class PlayerStructure {
public long lasthittarget=0;
public long lastbowmodeswitch=0;
public long lastsneak=0;
public long lastcombat=0;
public boolean isPlayingSpleef=false;

View File

@ -471,25 +471,31 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.getHealth()<p.getMaxHealth() &&
p.getFoodLevel()>=16) {
double totalregen = 1+(p.getMaxHealth()*0.05);
double bonusregen = 0.0;
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4);
totalregen += bonusregen;
for (ItemStack equip : equips) {
if (GenericFunctions.isArtifactEquip(equip)) {
double regenamt = GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH_REGEN, equip);
bonusregen += regenamt;
log("Bonus regen increased by "+regenamt,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)) {
totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)?2:1;
}
if (PlayerMode.getPlayerMode(p)!=PlayerMode.SLAYER || pd.lastcombat+(20*60)<getServerTickTime()) {
double totalregen = 1+(p.getMaxHealth()*0.05);
double bonusregen = 0.0;
bonusregen += ItemSet.TotalBaseAmountBasedOnSetBonusCount(GenericFunctions.getEquipment(p), p, ItemSet.ALIKAHN, 4, 4);
totalregen += bonusregen;
for (ItemStack equip : equips) {
if (GenericFunctions.isArtifactEquip(equip)) {
double regenamt = GenericFunctions.getAbilityValue(ArtifactAbility.HEALTH_REGEN, equip);
bonusregen += regenamt;
log("Bonus regen increased by "+regenamt,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)) {
totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, equip)?2:1;
}
}
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
}
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
pd.slayermodehp=p.getHealth();
}
}
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
totalregen /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
}
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
}
}
@ -3603,6 +3609,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
if (ev.getEntity() instanceof Player) {
Player p = (Player)ev.getEntity();
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
ev.setCancelled(true);
return;
}
if (p!=null) {
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(createHealthbar(((p.getHealth())/p.getMaxHealth())*100,p));
p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(p));
@ -4786,7 +4796,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
CustomDamage.ApplyDamage(0,p,m1,p.getEquipment().getItemInMainHand(),"AoE Damage",CustomDamage.NOAOE);
}
}
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9, 2);
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 39, 2);
} else {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9);
}
@ -6695,10 +6705,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
//Check the hotbar for set equips.
hp+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN);
}
//Check the hotbar for set equips.
hp+=ItemSet.GetTotalBaseAmount(GenericFunctions.getHotbarItems(p), p, ItemSet.GLADOMAIN);
log("Health is now "+hp,5);
if (ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())) {
maxdeduction /= ArtifactAbility.containsEnchantment(ArtifactAbility.GREED, p.getEquipment().getItemInMainHand())?2:1;
@ -6753,8 +6762,12 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
double slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp;
if (slayermodehp>p.getMaxHealth()) {
slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp = p.getMaxHealth();
if (ratio==null) {
if (slayermodehp>p.getMaxHealth()) {
slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp = p.getMaxHealth();
}
} else {
slayermodehp = PlayerStructure.GetPlayerStructure(p).slayermodehp = ratio*p.getMaxHealth();
}
p.setHealth(slayermodehp);
}