Finished implementation of all new Item Sets. Fixed soup eating bugs.
This commit is contained in:
parent
ed2f549416
commit
80adc60e12
Binary file not shown.
@ -68,6 +68,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.MonsterDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.MonsterType;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.PlayerMode;
|
||||
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.Effects.TemporaryBlockNode;
|
||||
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,"Weapon Charge Bonus Mult",dmg * calculateWeaponChargeBonusMultiplier(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")) {
|
||||
double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags));
|
||||
if (critdmg!=0.0) {crit=true;
|
||||
@ -319,6 +321,18 @@ public class CustomDamage {
|
||||
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) {
|
||||
double mult = 0.0;
|
||||
if (shooter instanceof Player) {
|
||||
@ -601,6 +615,7 @@ public class CustomDamage {
|
||||
reduceSwiftAegisBuff(p);
|
||||
restoreHealthToPartyMembersWithProtectorSet(p);
|
||||
applySustenanceSetonHitEffects(p);
|
||||
reduceStrengthAmountForStealthSet(p);
|
||||
if (!isFlagSet(flags,NOAOE)) {
|
||||
if (damage<p.getHealth()) {increaseArtifactArmorXP(p,(int)damage);}
|
||||
}
|
||||
@ -620,9 +635,11 @@ public class CustomDamage {
|
||||
//p.setHealth(pd.slayermodehp);
|
||||
//damage=0;
|
||||
if (GenericFunctions.hasStealth(p)) {
|
||||
if (!ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) {
|
||||
GenericFunctions.removeStealth(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
increaseBarbarianCharges(p);
|
||||
pd.slayermegahit=false;
|
||||
pd.lastcombat=TwosideKeeper.getServerTickTime();
|
||||
@ -834,6 +851,12 @@ public class CustomDamage {
|
||||
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) {
|
||||
if (reason!=null && reason.equalsIgnoreCase("sweep up")) {
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.PRIDE, 5)) {
|
||||
@ -1322,7 +1345,7 @@ public class CustomDamage {
|
||||
if (ItemSet.hasFullSet(p, ItemSet.DAWNTRACKER)) {
|
||||
amt*=2;
|
||||
}
|
||||
pd.weaponcharges+=amt;
|
||||
pd.weaponcharges=Math.min(pd.weaponcharges+amt,500);
|
||||
pd.customtitle.updateSideTitleStats(p);
|
||||
}
|
||||
}
|
||||
@ -2137,12 +2160,12 @@ public class CustomDamage {
|
||||
}
|
||||
dodgechance=addMultiplicativeValue(dodgechance,API.getPlayerBonuses(p).getBonusDodgeChance());
|
||||
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.ALIKAHN)/100d);
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.DARNYS)/100d);
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.JAMDAK)/100d);
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetTotalBaseAmount(p, ItemSet.LORASAADI)/100d);
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.ALIKAHN));
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.DARNYS));
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.JAMDAK));
|
||||
dodgechance=addMultiplicativeValue(dodgechance,ItemSet.GetMultiplicativeTotalBaseAmount(p, ItemSet.LORASAADI));
|
||||
//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);
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.LUCI, 2)) {
|
||||
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);
|
||||
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,3,3)/100d);
|
||||
@ -2202,7 +2225,7 @@ public class CustomDamage {
|
||||
return dodgechance;
|
||||
}
|
||||
|
||||
private static double addMultiplicativeValue(double numb, double val) {
|
||||
public static double addMultiplicativeValue(double numb, double val) {
|
||||
numb += (1-numb)*val;
|
||||
return numb;
|
||||
}
|
||||
@ -2996,7 +3019,7 @@ public class CustomDamage {
|
||||
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,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,(pd.slayermegahit)?1.0:0.0);
|
||||
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") &&
|
||||
ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.WINDRY, 4)) {
|
||||
critchance = addMultiplicativeValue(critchance,Buff.getBuff(p, "WINDCHARGE").getAmplifier()*0.01);
|
||||
@ -3080,6 +3106,9 @@ public class CustomDamage {
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(p, ItemSet.SHARD, 3)) {
|
||||
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);
|
||||
return critdmg;
|
||||
@ -3569,11 +3598,14 @@ public class CustomDamage {
|
||||
public static double calculateCooldownReduction(Player p) {
|
||||
double cooldown = 0.0;
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -3598,8 +3630,22 @@ public class CustomDamage {
|
||||
double mult = 0.0;
|
||||
if (target!=null && shooter!=null && isBackstab(target,shooter) &&
|
||||
(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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class DeathManager {
|
||||
public static List<DeathStructure> ds = new ArrayList<DeathStructure>();
|
||||
|
||||
public static void addNewDeathStructure(List<ItemStack> deathinv, Location deathloc, Player p) {
|
||||
ds.add(new DeathStructure(deathinv,deathloc,p));
|
||||
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),5);
|
||||
ds.add(new DeathStructure(deathinv,deathloc.clone(),p));
|
||||
TwosideKeeper.log("Added a new Death Structure: "+ds.get(ds.size()-1).toString(),0);
|
||||
}
|
||||
public static void removeDeathStructure(Player p) {
|
||||
ds.remove(getDeathStructure(p));
|
||||
|
@ -4382,9 +4382,13 @@ public class GenericFunctions {
|
||||
int duration = getPotionEffectDuration(type,p);
|
||||
int currentlv = getPotionEffectLevel(type,p);
|
||||
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) {
|
||||
logAndApplyPotionEffectToEntity(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true);
|
||||
//}
|
||||
}
|
||||
} else {
|
||||
PotionEffect neweffect = new PotionEffect(type,tick_duration,incr_amt-1);
|
||||
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));
|
||||
}
|
||||
pd.lastassassinatetime=TwosideKeeper.getServerTickTime();
|
||||
pd.lastusedassassinate=TwosideKeeper.getServerTickTime();
|
||||
if (ItemSet.HasSetBonusBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5)) {
|
||||
GenericFunctions.addIFrame(player, (int)ItemSet.TotalBaseAmountBasedOnSetBonusCount(player, ItemSet.WOLFSBANE, 5, 4));
|
||||
} else {
|
||||
@ -4703,6 +4708,7 @@ public class GenericFunctions {
|
||||
teleportloc.setDirection(dir);
|
||||
player.teleport(teleportloc);
|
||||
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.
|
||||
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) {
|
||||
if (ItemSet.GetSetCount(ItemSet.LORASYS, p)>=1 &&
|
||||
ItemSet.GetBaubleTier(p)>=27 && ItemSet.GetItemTier(p.getEquipment().getItemInMainHand())>=3) {
|
||||
if (ItemSet.meetsSlayerSwordConditions(ItemSet.LORASYS, 27, 3, p) ||
|
||||
ItemSet.meetsSlayerSwordConditions(ItemSet.STEALTH, 9, 1, p)) {
|
||||
return;
|
||||
} else {
|
||||
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) {
|
||||
Chunk c = l.getChunk();
|
||||
TwosideKeeper.temporary_chunks.add(c);
|
||||
@ -5357,4 +5404,37 @@ public class GenericFunctions {
|
||||
TwosideKeeper.temporary_chunks.remove(c);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import aPlugin.API;
|
||||
import sig.plugin.TwosideKeeper.CustomDamage;
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.BaublePouch;
|
||||
@ -838,7 +839,8 @@ public enum ItemSet {
|
||||
if (tier>=4) {
|
||||
lore.add(ChatColor.DARK_AQUA+" T40 - ");
|
||||
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
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
37
src/sig/plugin/TwosideKeeper/HelperStructures/ItemSlot.java
Normal file
37
src/sig/plugin/TwosideKeeper/HelperStructures/ItemSlot.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -121,6 +121,7 @@ public class PlayerStructure {
|
||||
public long turnedonsneak=0;
|
||||
public double slayermodehp=0;
|
||||
public long lastassassinatetime=0;
|
||||
public long lastusedassassinate=0;
|
||||
public long lastlifesavertime=0;
|
||||
public long lastusedbarbability=0;
|
||||
public boolean slayermegahit=false;
|
||||
@ -160,6 +161,7 @@ public class PlayerStructure {
|
||||
public long lastattack = TwosideKeeper.getServerTickTime();
|
||||
public boolean lastHitWasThorns=false;
|
||||
public boolean healthbardisplay=true;
|
||||
public long laststealthheal = TwosideKeeper.getServerTickTime();
|
||||
|
||||
public long iframetime = 0;
|
||||
|
||||
|
@ -208,6 +208,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.DamageStructure;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.FilterCubeItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSet;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemSlot;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.LivingEntityDifficulty;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Loot;
|
||||
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.SessionState;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.SpleefArena;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.VerifyItemWasMovedTask;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShop;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.WorldShopSession;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.ArrowQuiver;
|
||||
@ -1989,7 +1991,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}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();
|
||||
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 (!GenericFunctions.hasStealth(p)) {
|
||||
GenericFunctions.removeAggroFromNearbyTargets(p);
|
||||
GenericFunctions.applyStealth(p,true);
|
||||
} else {
|
||||
GenericFunctions.removeStealth(p);
|
||||
@ -5408,7 +5411,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
public void DropDeathInventoryContents(Player p, Location deathloc, int tickdelay) {
|
||||
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) {
|
||||
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) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
updateHealthbarDisplay(p,target);
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) {
|
||||
pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
|
||||
}
|
||||
if (pd.damagenumbers) {
|
||||
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;
|
||||
} else
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_PREEMPTIVE)) {
|
||||
pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
|
||||
//pd.customtitle.modifyLargeCenterTitle(ChatColor.BLUE+"!", 20);
|
||||
col = ChatColor.BLUE;
|
||||
} else
|
||||
if (CustomDamage.isFlagSet(pd.lasthitproperties, CustomDamage.IS_HEADSHOT)) {
|
||||
@ -7469,7 +7475,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
|
||||
if (pd.lastassassinatetime+20>getServerTickTime()) { //Successful Assassination.
|
||||
if (pd.lastusedassassinate+20>getServerTickTime()) { //Successful Assassination.
|
||||
pd.lastassassinatetime=0;
|
||||
ItemStack[] inv = p.getInventory().getContents();
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
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));
|
||||
}}
|
||||
,50);
|
||||
} else {
|
||||
droplist.addAll(originaldroplist);
|
||||
}
|
||||
break;
|
||||
case HELLFIRE:
|
||||
@ -7753,6 +7765,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
GenericFunctions.spawnXP(mer1.getLocation(), (int)(expdrop1*0.25));
|
||||
}}
|
||||
,50);
|
||||
} else {
|
||||
droplist.addAll(originaldroplist);
|
||||
}
|
||||
break;
|
||||
case END:
|
||||
@ -7787,6 +7801,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
GenericFunctions.spawnXP(mer4.getLocation(), (int)(expdrop4*0.25));
|
||||
}}
|
||||
,50);
|
||||
} else {
|
||||
droplist.addAll(originaldroplist);
|
||||
}
|
||||
break;
|
||||
case ELITE:
|
||||
@ -8032,6 +8048,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
p.getEquipment().setItemInMainHand(oldMainHand);
|
||||
oldOffHand.setAmount(oldOffHand.getAmount()-1);
|
||||
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 {
|
||||
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);
|
||||
@ -8043,7 +8061,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
private boolean EatingSoupFromOffHand(Player p) {
|
||||
return isSoup(p.getEquipment().getItemInOffHand()) &&
|
||||
p.getEquipment().getItemInOffHand().getAmount()>1 &&
|
||||
!isSoup(p.getEquipment().getItemInMainHand());
|
||||
!GenericFunctions.isFood(p.getEquipment().getItemInMainHand());
|
||||
}
|
||||
private boolean isSoup(ItemStack item) {
|
||||
return item.getType()==Material.MUSHROOM_SOUP ||
|
||||
|
@ -267,6 +267,8 @@ final class runServerHeartbeat implements Runnable {
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Auto Consume Food", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
}
|
||||
|
||||
PerformStealthSetRegen(p,pd);
|
||||
|
||||
updateCustomTitle(p, pd);
|
||||
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();
|
||||
}
|
||||
|
||||
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) {
|
||||
//pd.customtitle.updateTitle(p);
|
||||
pd.customtitle.checkExpiredTitles();
|
||||
@ -710,10 +726,12 @@ final class runServerHeartbeat implements Runnable {
|
||||
}
|
||||
|
||||
private void ModifyDasherSetSpeedMultiplier(Player p) {
|
||||
double spdmult = 0.0;
|
||||
if (ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)>0) {
|
||||
double spdmult = ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d;
|
||||
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
|
||||
spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.DASHER)/100d;
|
||||
}
|
||||
spdmult += ItemSet.GetTotalBaseAmount(p, ItemSet.STEALTH)/100d;
|
||||
aPlugin.API.setPlayerSpeedMultiplier(p, (float)(1.0f+spdmult));
|
||||
}
|
||||
|
||||
private void EndShopSession(Player p) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user