Finished implementation of all new Item Sets. Fixed soup eating bugs.

This commit is contained in:
sigonasr2 2017-05-21 01:15:10 -05:00
parent ed2f549416
commit 80adc60e12
10 changed files with 274 additions and 26 deletions

Binary file not shown.

View File

@ -68,6 +68,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType; import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode; import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions; import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode; import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryBlockNode;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils; import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArtifactUtils;
@ -284,6 +285,7 @@ public class CustomDamage {
dmg += addMultiplierToPlayerLogger(damager,target,"Damage Reduction Set Bonus Mult",dmg * calculateDamageReductionSetBonusMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Damage Reduction Set Bonus Mult",dmg * calculateDamageReductionSetBonusMultiplier(shooter));
dmg += addMultiplierToPlayerLogger(damager,target,"Weapon Charge Bonus Mult",dmg * calculateWeaponChargeBonusMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Weapon Charge Bonus Mult",dmg * calculateWeaponChargeBonusMultiplier(shooter));
dmg += addMultiplierToPlayerLogger(damager,target,"Damage Pool Bonus Mult",dmg * calculateDamagePoolBonusMultiplier(shooter)); dmg += addMultiplierToPlayerLogger(damager,target,"Damage Pool Bonus Mult",dmg * calculateDamagePoolBonusMultiplier(shooter));
dmg += addMultiplierToPlayerLogger(damager,target,"Stealth Mult",dmg * calculateStealthMultiplier(shooter));
if (reason==null || !reason.equalsIgnoreCase("Test Damage")) { if (reason==null || !reason.equalsIgnoreCase("Test Damage")) {
double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags)); double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags));
if (critdmg!=0.0) {crit=true; if (critdmg!=0.0) {crit=true;
@ -319,6 +321,18 @@ public class CustomDamage {
return dmg; return dmg;
} }
private static double calculateStealthMultiplier(LivingEntity shooter) {
double mult = 0.0;
if (shooter instanceof Player) {
Player p = (Player)shooter;
if (GenericFunctions.hasStealth(p) &&
ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 18, 2, p)) {
mult += 0.5;
}
}
return mult;
}
private static double calculateDamagePoolBonusMultiplier(LivingEntity shooter) { private static double calculateDamagePoolBonusMultiplier(LivingEntity shooter) {
double mult = 0.0; double mult = 0.0;
if (shooter instanceof Player) { if (shooter instanceof Player) {
@ -601,6 +615,7 @@ public class CustomDamage {
reduceSwiftAegisBuff(p); reduceSwiftAegisBuff(p);
restoreHealthToPartyMembersWithProtectorSet(p); restoreHealthToPartyMembersWithProtectorSet(p);
applySustenanceSetonHitEffects(p); applySustenanceSetonHitEffects(p);
reduceStrengthAmountForStealthSet(p);
if (!isFlagSet(flags,NOAOE)) { if (!isFlagSet(flags,NOAOE)) {
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);} if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
} }
@ -620,9 +635,11 @@ public class CustomDamage {
//p.setHealth(pd.slayermodehp); //p.setHealth(pd.slayermodehp);
//damage=0; //damage=0;
if (GenericFunctions.hasStealth(p)) { if (GenericFunctions.hasStealth(p)) {
if (!ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) {
GenericFunctions.removeStealth(p); GenericFunctions.removeStealth(p);
} }
} }
}
increaseBarbarianCharges(p); increaseBarbarianCharges(p);
pd.slayermegahit=false; pd.slayermegahit=false;
pd.lastcombat=TwosideKeeper.getServerTickTime(); pd.lastcombat=TwosideKeeper.getServerTickTime();
@ -834,6 +851,12 @@ public class CustomDamage {
return damage; return damage;
} }
private static void reduceStrengthAmountForStealthSet(Player p) {
if (ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 27, 3, p)) {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 20*60, 19,-1);
}
}
private static void addSweepupBonus(Player p, double damage, String reason) { private static void addSweepupBonus(Player p, double damage, String reason) {
if (reason!=null && reason.equalsIgnoreCase("sweep up")) { if (reason!=null && reason.equalsIgnoreCase("sweep up")) {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PRIDE, 5)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PRIDE, 5)) {
@ -1322,7 +1345,7 @@ public class CustomDamage {
if (ItemSet.hasFullSet(p, ItemSet.DAWNTRACKER)) { if (ItemSet.hasFullSet(p, ItemSet.DAWNTRACKER)) {
amt*=2; amt*=2;
} }
pd.weaponcharges+=amt; pd.weaponcharges=Math.min(pd.weaponcharges+amt,500);
pd.customtitle.updateSideTitleStats(p); pd.customtitle.updateSideTitleStats(p);
} }
} }
@ -2137,12 +2160,12 @@ public class CustomDamage {
} }
dodgechance=addMultiplicativeValue(dodgechance,API.getPlayerBonuses(p).getBonusDodgeChance()); dodgechance=addMultiplicativeValue(dodgechance,API.getPlayerBonuses(p).getBonusDodgeChance());
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.ALIKAHN)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.ALIKAHN));
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.DARNYS)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.DARNYS));
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.JAMDAK)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.JAMDAK));
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.LORASAADI)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.LORASAADI));
//TwosideKeeper.log("Dodge Chance: "+dodgechance, 0); //TwosideKeeper.log("Dodge Chance: "+dodgechance, 0);
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.SHARD)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SHARD));
//TwosideKeeper.log("Dodge Chance: "+dodgechance, 0); //TwosideKeeper.log("Dodge Chance: "+dodgechance, 0);
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 2)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 2)) {
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LUCI, 2, 2)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.LUCI, 2, 2)/100d);
@ -2156,7 +2179,7 @@ public class CustomDamage {
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,3,3)/100d);
if (p.isBlocking()) { if (p.isBlocking()) {
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.SONGSTEEL)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.SONGSTEEL));
} }
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,2,2)/100d);
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d); dodgechance=addMultiplicativeValue(dodgechance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.JAMDAK,3,3)/100d);
@ -2202,7 +2225,7 @@ public class CustomDamage {
return dodgechance; return dodgechance;
} }
private static double addMultiplicativeValue(double numb, double val) { public static double addMultiplicativeValue(double numb, double val) {
numb += (1-numb)*val; numb += (1-numb)*val;
return numb; return numb;
} }
@ -2996,7 +3019,7 @@ public class CustomDamage {
critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d); critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p,ItemSet.PANROS,4,4)/100d);
critchance = addMultiplicativeValue(critchance,(PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0)); critchance = addMultiplicativeValue(critchance,(PlayerMode.isRanger(p)?(GenericFunctions.getPotionEffectLevel(PotionEffectType.SLOW, p)+1)*0.1:0.0));
critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 5, 4)/100d); critchance = addMultiplicativeValue(critchance,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.MOONSHADOW, 5, 4)/100d);
critchance = addMultiplicativeValue(critchance,ItemSet.GetTotalBaseAmount(p, ItemSet.WOLFSBANE)/100d); critchance = addMultiplicativeValue(critchance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.WOLFSBANE));
critchance = addMultiplicativeValue(critchance,API.getPlayerBonuses(p).getBonusCriticalChance()); critchance = addMultiplicativeValue(critchance,API.getPlayerBonuses(p).getBonusCriticalChance());
critchance = addMultiplicativeValue(critchance,(pd.slayermegahit)?1.0:0.0); critchance = addMultiplicativeValue(critchance,(pd.slayermegahit)?1.0:0.0);
if (reason!=null && reason.equalsIgnoreCase("power swing")) { if (reason!=null && reason.equalsIgnoreCase("power swing")) {
@ -3015,6 +3038,9 @@ public class CustomDamage {
} }
} }
} }
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 40, 4, p)) {
critchance = addMultiplicativeValue(critchance,0.3d);
}
if (Buff.hasBuff(p, "WINDCHARGE") && if (Buff.hasBuff(p, "WINDCHARGE") &&
ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 4)) { ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 4)) {
critchance = addMultiplicativeValue(critchance,Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01); critchance = addMultiplicativeValue(critchance,Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01);
@ -3080,6 +3106,9 @@ public class CustomDamage {
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SHARD, 3)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SHARD, 3)) {
critdmg+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 3, 3)/100d; critdmg+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.SHARD, 3, 3)/100d;
} }
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 40, 4, p)) {
critdmg+=1.0;
}
} }
TwosideKeeper.log("Crit Damage is "+critdmg, 5); TwosideKeeper.log("Crit Damage is "+critdmg, 5);
return critdmg; return critdmg;
@ -3569,11 +3598,14 @@ public class CustomDamage {
public static double calculateCooldownReduction(Player p) { public static double calculateCooldownReduction(Player p) {
double cooldown = 0.0; double cooldown = 0.0;
cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 2, 2)/100d); cooldown=addMultiplicativeValue(cooldown,ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 2, 2)/100d);
cooldown=addMultiplicativeValue(cooldown,ItemSet.GetTotalBaseAmount(p, ItemSet.VIXEN)/100d); cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.VIXEN));
if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 40, 4, p)) { if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 40, 4, p)) {
cooldown = addMultiplicativeValue(cooldown,0.45d); cooldown = addMultiplicativeValue(cooldown,0.45d);
} }
cooldown=addMultiplicativeValue(cooldown,ItemSet.GetTotalBaseAmount(p, ItemSet.ASSASSIN)/100d); cooldown=addMultiplicativeValue(cooldown,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.ASSASSIN));
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 40, 4, p)) {
cooldown = addMultiplicativeValue(cooldown,0.3d);
}
return cooldown; return cooldown;
} }
@ -3598,8 +3630,22 @@ public class CustomDamage {
double mult = 0.0; double mult = 0.0;
if (target!=null && shooter!=null && isBackstab(target,shooter) && if (target!=null && shooter!=null && isBackstab(target,shooter) &&
(shooter instanceof Player) && PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.SLAYER) { (shooter instanceof Player) && PlayerMode.getPlayerMode((Player)shooter)==PlayerMode.SLAYER) {
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 27, 3, (Player)shooter)) {
mult+=5.0;
} else {
mult+=2.0; mult+=2.0;
} }
if (ItemSet.meetsSlayerSwordConditions(ItemSet.ASSASSIN, 18, 2, (Player)shooter)) {
Material name = ((Player)shooter).getEquipment().getItemInMainHand().getType();
PlayerStructure pd = PlayerStructure.GetPlayerStructure((Player)shooter);
pd.lastassassinatetime-=(int)(GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,(Player)shooter)*0.5);
//TwosideKeeper.log("Subtracted "+(int)(GenericFunctions.GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,(Player)shooter)*0.5)+" ticks from Last Assassinate.", 0);
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GenericFunctions.GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,(Player)shooter)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
//aPlugin.API.sendCooldownPacket((Player)shooter, name, (int)(GenericFunctions.GetModifiedCooldown((TwosideKeeper.ASSASSINATE_COOLDOWN),(Player)shooter)*0.5));
aPlugin.API.sendCooldownPacket((Player)shooter, name, GenericFunctions.GetRemainingCooldownTime((Player)shooter, pd.lastassassinatetime, TwosideKeeper.ASSASSINATE_COOLDOWN));
}
}
}
return mult; return mult;
} }

View File

@ -27,8 +27,8 @@ public class DeathManager {
public static List<DeathStructure> ds = new ArrayList<DeathStructure>(); public static List<DeathStructure> ds = new ArrayList<DeathStructure>();
public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) { public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) {
ds.add(new DeathStructure(deathinv,deathloc,p)); ds.add(new DeathStructure(deathinv,deathloc.clone(),p));
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),5); TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),0);
} }
public static void removeDeathStructure(Player p) { public static void removeDeathStructure(Player p) {
ds.remove(getDeathStructure(p)); ds.remove(getDeathStructure(p));

View File

@ -4382,9 +4382,13 @@ public class GenericFunctions {
int duration = getPotionEffectDuration(type,p); int duration = getPotionEffectDuration(type,p);
int currentlv = getPotionEffectLevel(type,p); int currentlv = getPotionEffectLevel(type,p);
PotionEffect neweffect = new PotionEffect(type,tick_duration,(currentlv+incr_amt<maxlv)?(currentlv+incr_amt):maxlv); PotionEffect neweffect = new PotionEffect(type,tick_duration,(currentlv+incr_amt<maxlv)?(currentlv+incr_amt):maxlv);
if (neweffect.getAmplifier()<0) {
logAndRemovePotionEffectFromEntity(PotionEffectType.INCREASE_DAMAGE,p);
} else {
//if (tick_duration+BUFFER >= duration) { //if (tick_duration+BUFFER >= duration) {
logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true); logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true);
//} //}
}
} else { } else {
PotionEffect neweffect = new PotionEffect(type,tick_duration,incr_amt-1); PotionEffect neweffect = new PotionEffect(type,tick_duration,incr_amt-1);
logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true); logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true);
@ -4639,6 +4643,7 @@ public class GenericFunctions {
aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player)); aPlugin.API.sendCooldownPacket(player, name, GetModifiedCooldown(TwosideKeeper.ASSASSINATE_COOLDOWN,player));
} }
pd.lastassassinatetime=TwosideKeeper.getServerTickTime(); pd.lastassassinatetime=TwosideKeeper.getServerTickTime();
pd.lastusedassassinate=TwosideKeeper.getServerTickTime();
if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5)) {
GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5, 4)); GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5, 4));
} else { } else {
@ -4703,6 +4708,7 @@ public class GenericFunctions {
teleportloc.setDirection(dir); teleportloc.setDirection(dir);
player.teleport(teleportloc); player.teleport(teleportloc);
PlayerStructure pd = PlayerStructure.GetPlayerStructure(player); PlayerStructure pd = PlayerStructure.GetPlayerStructure(player);
pd.lastusedassassinate=TwosideKeeper.getServerTickTime();
if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns. if (name!=Material.SKULL_ITEM || pd.lastlifesavertime+GetModifiedCooldown(TwosideKeeper.LIFESAVER_COOLDOWN,player)<TwosideKeeper.getServerTickTime()) { //Don't overwrite life saver cooldowns.
aPlugin.API.sendCooldownPacket(player, name, (int)(GetModifiedCooldown((TwosideKeeper.ASSASSINATE_COOLDOWN),player)*0.3)); aPlugin.API.sendCooldownPacket(player, name, (int)(GetModifiedCooldown((TwosideKeeper.ASSASSINATE_COOLDOWN),player)*0.3));
} }
@ -4801,8 +4807,8 @@ public class GenericFunctions {
} }
public static void DamageRandomTool(Player p) { public static void DamageRandomTool(Player p) {
if (ItemSet.GetSetCount(ItemSet.LORASYS, p)>=1 && if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 27, 3, p) ||
ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=3) { ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) {
return; return;
} else { } else {
if (!aPlugin.API.isAFK(p)) { if (!aPlugin.API.isAFK(p)) {
@ -5345,6 +5351,47 @@ public class GenericFunctions {
} }
} }
public static boolean isFood(ItemStack item) {
Material mat = item.getType();
//Because Storm is boosted.
return (mat==Material.GOLDEN_CARROT ||
mat==Material.GOLDEN_APPLE ||
mat==Material.COOKED_BEEF ||
mat==Material.PORK ||
mat==Material.COOKED_MUTTON ||
mat==Material.COOKED_FISH ||
mat==Material.SPIDER_EYE ||
mat==Material.COOKED_CHICKEN ||
mat==Material.COOKED_RABBIT ||
mat==Material.MUSHROOM_SOUP ||
mat==Material.BEETROOT_SOUP ||
mat==Material.BREAD ||
mat==Material.CARROT_ITEM ||
//I hate you Orni.
mat==Material.BAKED_POTATO ||
mat==Material.BEETROOT ||
mat==Material.RABBIT_STEW ||
mat==Material.PUMPKIN_PIE ||
mat==Material.APPLE ||
mat==Material.RAW_BEEF ||
mat==Material.GRILLED_PORK ||
//Really hate.
mat==Material.RAW_CHICKEN ||
mat==Material.MUTTON ||
mat==Material.RABBIT ||
mat==Material.POISONOUS_POTATO ||
mat==Material.MELON ||
mat==Material.POTATO_ITEM ||
mat==Material.CHORUS_FRUIT ||
mat==Material.COOKIE ||
mat==Material.ROTTEN_FLESH ||
mat==Material.RAW_FISH ||
mat==Material.MILK_BUCKET ||
mat==Material.POTION
//Tilted. TILTED.
);
}
public static void dropItem(ItemStack oldMainHand, Location l) { public static void dropItem(ItemStack oldMainHand, Location l) {
Chunk c = l.getChunk(); Chunk c = l.getChunk();
TwosideKeeper.temporary_chunks.add(c); TwosideKeeper.temporary_chunks.add(c);
@ -5357,4 +5404,37 @@ public class GenericFunctions {
TwosideKeeper.temporary_chunks.remove(c); TwosideKeeper.temporary_chunks.remove(c);
c.unload(); c.unload();
} }
public static void removeAggroFromNearbyTargets(Player p) {
List<Entity> ents = p.getNearbyEntities(16, 16, 16);
for (Entity e : ents) {
if (e instanceof LivingEntity) {
LivingEntity l = (LivingEntity)e;
LivingEntityStructure les = LivingEntityStructure.GetLivingEntityStructure(l);
if (les.GetTarget()!=null &&
les.GetTarget().equals(p)) {
l.setAI(false);
les.SetTarget(null);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (l!=null && l.isValid()) {
l.setAI(true);
}
}, 1);
}
if (l instanceof Monster) {
Monster m = (Monster)l;
if (m.getTarget()!=null &&
m.getTarget().equals(p)) {
m.setAI(false);
m.setTarget(null);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (m!=null && m.isValid()) {
m.setAI(true);
}
}, 1);
}
}
}
}
}
} }

View File

@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import aPlugin.API; import aPlugin.API;
import sig.plugin.TwosideKeeper.CustomDamage;
import sig.plugin.TwosideKeeper.PlayerStructure; import sig.plugin.TwosideKeeper.PlayerStructure;
import sig.plugin.TwosideKeeper.TwosideKeeper; import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch; import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
@ -838,7 +839,8 @@ public enum ItemSet {
if (tier>=4) { if (tier>=4) {
lore.add(ChatColor.DARK_AQUA+" T40 - "); lore.add(ChatColor.DARK_AQUA+" T40 - ");
lore.add(ChatColor.WHITE+" +30% Cooldown Reduction"); lore.add(ChatColor.WHITE+" +30% Cooldown Reduction");
lore.add(ChatColor.WHITE+" +100% Critical Strike Chance"); lore.add(ChatColor.WHITE+" +30% Critical Strike Chance");
lore.add(ChatColor.WHITE+" +100% Critical Strike Damage");
} }
} }
} }
@ -1136,4 +1138,18 @@ public enum ItemSet {
} else } else
return 1; return 1;
} }
public static double GetMultiplicativeTotalBaseAmount(Player p, ItemSet set) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
double val = 0;
if (pd.itemsets.containsKey(set.name())) {
HashMap<Integer,Integer> tiermap = pd.itemsets.get(set.name());
for (Integer tier : tiermap.keySet()) {
for (int i=0;i<tiermap.get(tier);i++) {
val = CustomDamage.addMultiplicativeValue(val, set.GetBaseAmount(tier)/100d);
}
}
}
return val;
}
} }

View File

@ -0,0 +1,37 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public enum ItemSlot {
MAINHAND,
OFFHAND;
public ItemStack getItem(Player p) {
switch (this) {
case MAINHAND:
return p.getEquipment().getItemInMainHand();
case OFFHAND:
return p.getEquipment().getItemInOffHand();
default:
TwosideKeeper.log("WARNING! Could not find proper enum for this item slot! Slot: "+this, 0);
return p.getEquipment().getItemInMainHand();
}
}
public void setItem(Player p, ItemStack item) {
switch (this) {
case MAINHAND:
p.getEquipment().setItemInMainHand(item);
break;
case OFFHAND:
p.getEquipment().setItemInOffHand(item);
break;
default:
TwosideKeeper.log("WARNING! Could not find proper enum for this item slot! Slot: "+this, 0);
p.getEquipment().setItemInMainHand(item);
}
}
}

View File

@ -0,0 +1,31 @@
package sig.plugin.TwosideKeeper.HelperStructures;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import sig.plugin.TwosideKeeper.TwosideKeeper;
public class VerifyItemWasMovedTask implements Runnable{
ItemStack checkitem;
ItemSlot slot;
Player p;
public VerifyItemWasMovedTask(ItemStack checkitem, Player p, ItemSlot slot) {
this.checkitem=checkitem.clone();
this.p=p;
this.slot=slot;
}
@Override
public void run() {
if (!slot.getItem(p).isSimilar(checkitem)) {
TwosideKeeper.log("WARNING! Item "+checkitem+" was not inserted in slot "+slot.name()+" properly! Item in slot atm: "+slot.getItem(p)+". Trying again in 1 tick!", 1);
//This is bad. Try again on the next tick. Set the item.
slot.setItem(p, checkitem);
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, this, 1);
}
}
}

View File

@ -121,6 +121,7 @@ public class PlayerStructure {
public long turnedonsneak=0; public long turnedonsneak=0;
public double slayermodehp=0; public double slayermodehp=0;
public long lastassassinatetime=0; public long lastassassinatetime=0;
public long lastusedassassinate=0;
public long lastlifesavertime=0; public long lastlifesavertime=0;
public long lastusedbarbability=0; public long lastusedbarbability=0;
public boolean slayermegahit=false; public boolean slayermegahit=false;
@ -160,6 +161,7 @@ public class PlayerStructure {
public long lastattack = TwosideKeeper.getServerTickTime(); public long lastattack = TwosideKeeper.getServerTickTime();
public boolean lastHitWasThorns=false; public boolean lastHitWasThorns=false;
public boolean healthbardisplay=true; public boolean healthbardisplay=true;
public long laststealthheal = TwosideKeeper.getServerTickTime();
public long iframetime = 0; public long iframetime = 0;

View File

@ -208,6 +208,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.DamageStructure;
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem; import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube; import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet; import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
import sig.plugin.TwosideKeeper.HelperStructures.ItemSlot;
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty; import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
import sig.plugin.TwosideKeeper.HelperStructures.Loot; import sig.plugin.TwosideKeeper.HelperStructures.Loot;
import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest; import sig.plugin.TwosideKeeper.HelperStructures.MalleableBaseQuest;
@ -219,6 +220,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.QuestStatus;
import sig.plugin.TwosideKeeper.HelperStructures.ServerType; import sig.plugin.TwosideKeeper.HelperStructures.ServerType;
import sig.plugin.TwosideKeeper.HelperStructures.SessionState; import sig.plugin.TwosideKeeper.HelperStructures.SessionState;
import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena; import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena;
import sig.plugin.TwosideKeeper.HelperStructures.VerifyItemWasMovedTask;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop; import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession; import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession;
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver; import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
@ -1989,7 +1991,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}break; }break;
} }
} }
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE); LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
/* /*
StackTraceElement[] stacktrace = new Throwable().getStackTrace(); StackTraceElement[] stacktrace = new Throwable().getStackTrace();
StringBuilder stack = new StringBuilder("Mini stack tracer:"); StringBuilder stack = new StringBuilder("Mini stack tracer:");
@ -3471,6 +3473,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
if (!ev.isSneaking() && p.isOnGround() && pd.turnedonsneak+10>getServerTickTime()) { if (!ev.isSneaking() && p.isOnGround() && pd.turnedonsneak+10>getServerTickTime()) {
if (!GenericFunctions.hasStealth(p)) { if (!GenericFunctions.hasStealth(p)) {
GenericFunctions.removeAggroFromNearbyTargets(p);
GenericFunctions.applyStealth(p,true); GenericFunctions.applyStealth(p,true);
} else { } else {
GenericFunctions.removeStealth(p); GenericFunctions.removeStealth(p);
@ -5408,7 +5411,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
public void DropDeathInventoryContents(Player p, Location deathloc, int tickdelay) { public void DropDeathInventoryContents(Player p, Location deathloc, int tickdelay) {
List<ItemStack> list = PrepareDropItems(p); List<ItemStack> list = PrepareDropItems(p);
Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,list,deathloc),tickdelay); Bukkit.getScheduler().scheduleSyncDelayedTask(this,new DropDeathItems(p,list,deathloc.clone()),tickdelay);
} }
public List<ItemStack> PrepareDropItems(Player p) { public List<ItemStack> PrepareDropItems(Player p) {
Inventory contents = Bukkit.createInventory(p, 45); Inventory contents = Bukkit.createInventory(p, 45);
@ -6806,6 +6809,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static void updateHealthbarDisplay(Player p, LivingEntity target, double damage, int flags) { public static void updateHealthbarDisplay(Player p, LivingEntity target, double damage, int flags) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
updateHealthbarDisplay(p,target); updateHealthbarDisplay(p,target);
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) {
pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
}
if (pd.damagenumbers) { if (pd.damagenumbers) {
if (Bukkit.getPlayer(pd.name)!=null && target!=null) { if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
if (Bukkit.getPlayer(pd.name)!=null && target!=null) { if (Bukkit.getPlayer(pd.name)!=null && target!=null) {
@ -6815,7 +6821,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
col = ChatColor.YELLOW; col = ChatColor.YELLOW;
} else } else
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) { if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) {
pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20); //pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
col = ChatColor.BLUE; col = ChatColor.BLUE;
} else } else
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_HEADSHOT)) { if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_HEADSHOT)) {
@ -7469,7 +7475,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
if (pd.lastassassinatetime+20>getServerTickTime()) { //Successful Assassination. if (pd.lastusedassassinate+20>getServerTickTime()) { //Successful Assassination.
pd.lastassassinatetime=0; pd.lastassassinatetime=0;
ItemStack[] inv = p.getInventory().getContents(); ItemStack[] inv = p.getInventory().getContents();
for (int i=0;i<9;i++) { for (int i=0;i<9;i++) {
@ -7493,7 +7499,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 39, 2); GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 39, 2);
} else { } else
if (ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 27, 3, p)) {
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 20*60, 19);
} else
{
GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9); GenericFunctions.addStackingPotionEffect(p, PotionEffectType.INCREASE_DAMAGE, 10*20, 9);
} }
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7)) { if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.GLADOMAIN, 7)) {
@ -7719,6 +7729,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.spawnXP(mer.getLocation(), (int)(expdrop*0.25)); GenericFunctions.spawnXP(mer.getLocation(), (int)(expdrop*0.25));
}} }}
,50); ,50);
} else {
droplist.addAll(originaldroplist);
} }
break; break;
case HELLFIRE: case HELLFIRE:
@ -7753,6 +7765,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.spawnXP(mer1.getLocation(), (int)(expdrop1*0.25)); GenericFunctions.spawnXP(mer1.getLocation(), (int)(expdrop1*0.25));
}} }}
,50); ,50);
} else {
droplist.addAll(originaldroplist);
} }
break; break;
case END: case END:
@ -7787,6 +7801,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.spawnXP(mer4.getLocation(), (int)(expdrop4*0.25)); GenericFunctions.spawnXP(mer4.getLocation(), (int)(expdrop4*0.25));
}} }}
,50); ,50);
} else {
droplist.addAll(originaldroplist);
} }
break; break;
case ELITE: case ELITE:
@ -8032,6 +8048,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.getEquipment().setItemInMainHand(oldMainHand); p.getEquipment().setItemInMainHand(oldMainHand);
oldOffHand.setAmount(oldOffHand.getAmount()-1); oldOffHand.setAmount(oldOffHand.getAmount()-1);
p.getEquipment().setItemInOffHand(oldOffHand); p.getEquipment().setItemInOffHand(oldOffHand);
Bukkit.getScheduler().runTaskLater(this, new VerifyItemWasMovedTask(oldMainHand.clone(),p,ItemSlot.MAINHAND), 1);
Bukkit.getScheduler().runTaskLater(this, new VerifyItemWasMovedTask(oldOffHand.clone(),p,ItemSlot.OFFHAND), 1);
} else { } else {
TwosideKeeper.log("WARNING!! Could not give recovered item for eating soup from off-hand back! Dropping "+oldMainHand+" at Location "+l, 1); TwosideKeeper.log("WARNING!! Could not give recovered item for eating soup from off-hand back! Dropping "+oldMainHand+" at Location "+l, 1);
GenericFunctions.dropItem(oldMainHand, l); GenericFunctions.dropItem(oldMainHand, l);
@ -8043,7 +8061,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
private boolean EatingSoupFromOffHand(Player p) { private boolean EatingSoupFromOffHand(Player p) {
return isSoup(p.getEquipment().getItemInOffHand()) && return isSoup(p.getEquipment().getItemInOffHand()) &&
p.getEquipment().getItemInOffHand().getAmount()>1 && p.getEquipment().getItemInOffHand().getAmount()>1 &&
!isSoup(p.getEquipment().getItemInMainHand()); !GenericFunctions.isFood(p.getEquipment().getItemInMainHand());
} }
private boolean isSoup(ItemStack item) { private boolean isSoup(ItemStack item) {
return item.getType()==Material.MUSHROOM_SOUP || return item.getType()==Material.MUSHROOM_SOUP ||

View File

@ -267,6 +267,8 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.HeartbeatLogger.AddEntry("Auto Consume Food", (int)(System.nanoTime()-time));time=System.nanoTime(); TwosideKeeper.HeartbeatLogger.AddEntry("Auto Consume Food", (int)(System.nanoTime()-time));time=System.nanoTime();
} }
PerformStealthSetRegen(p,pd);
updateCustomTitle(p, pd); updateCustomTitle(p, pd);
TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime(); TwosideKeeper.HeartbeatLogger.AddEntry("Update Custom Title", (int)(System.nanoTime()-time));time=System.nanoTime();
} }
@ -350,6 +352,20 @@ final class runServerHeartbeat implements Runnable {
TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime(); TwosideKeeper.HeartbeatLogger.AddEntry(ChatColor.LIGHT_PURPLE+"Total Server Heartbeat", (int)(System.nanoTime()-totaltime));totaltime=System.nanoTime();
} }
private void PerformStealthSetRegen(Player p, PlayerStructure pd) {
if (pd.laststealthheal+100<=TwosideKeeper.getServerTickTime() &&
GenericFunctions.hasStealth(p) &&
ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 40, 4, p)) {
GenericFunctions.HealEntity(p, 2);
if (pd.slayermodehp+2<p.getMaxHealth()) {
pd.slayermodehp+=2;
} else {
pd.slayermodehp=p.getMaxHealth();
}
pd.laststealthheal=TwosideKeeper.getServerTickTime();
}
}
private void updateCustomTitle(Player p, PlayerStructure pd) { private void updateCustomTitle(Player p, PlayerStructure pd) {
//pd.customtitle.updateTitle(p); //pd.customtitle.updateTitle(p);
pd.customtitle.checkExpiredTitles(); pd.customtitle.checkExpiredTitles();
@ -710,10 +726,12 @@ final class runServerHeartbeat implements Runnable {
} }
private void ModifyDasherSetSpeedMultiplier(Player p) { private void ModifyDasherSetSpeedMultiplier(Player p) {
double spdmult = 0.0;
if (ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)>0) { if (ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)>0) {
double spdmult = ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d; spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d;
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
} }
spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.STEALTH)/100d;
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
} }
private void EndShopSession(Player p) { private void EndShopSession(Player p) {