Skip to content

Commit

Permalink
Sirius hotfix + Heavenly Boon Fix (#4067)
Browse files Browse the repository at this point in the history
  • Loading branch information
MistHelix authored Jan 14, 2024
1 parent 82ed39c commit 0ed41dc
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.playmonumenta.plugins.events.DamageEvent;
import com.playmonumenta.plugins.itemstats.EffectType;
import com.playmonumenta.plugins.itemstats.abilities.CharmManager;
import com.playmonumenta.plugins.server.properties.ServerProperties;
import com.playmonumenta.plugins.utils.EntityUtils;
import com.playmonumenta.plugins.utils.FastUtils;
import com.playmonumenta.plugins.utils.InventoryUtils;
Expand Down Expand Up @@ -70,38 +71,38 @@ public final class HeavenlyBoon extends Ability implements KillTriggeredAbility


public static final AbilityInfo<HeavenlyBoon> INFO =
new AbilityInfo<>(HeavenlyBoon.class, "Heavenly Boon", HeavenlyBoon::new)
.scoreboardId("HeavenlyBoon")
.shorthandName("HB")
.descriptions(
"Whenever you are hit with a positive splash potion, the effects are also given to other players in a 12 block radius. In addition, whenever an undead mob you have hit within 1.5s dies or you deal damage to a boss (R1 100/R2 200/R3 300), you have a 10% chance to be splashed with an 20% Instant Health potion, with an additional effect of either Regen I, +10% Strength, +10% Resistance, +20% Speed, or +20% Absorption with a 20 second duration.",
"The chance to be splashed upon killing an undead mob is increased to 20%. The effect potions now give 40% Instant Health and the durations of each are increased to 50 seconds.",
String.format(
"When a potion is created by this skill, also increase all current positive potion durations by %s%%" +
" (up to a maximum of %s hours, and up to %s times per effect) on all players in the radius.",
(int) (ENHANCEMENT_POTION_EFFECT_BONUS * 100),
ENHANCEMENT_POTION_EFFECT_MAX_DURATION / (60 * 60 * 20),
MAX_EXTENSIONS
))
.simpleDescription("Share all positive splash potion effects with nearby players and occasionally generate splash potions when killing Undead enemies.")
.displayItem(Material.SPLASH_POTION);
new AbilityInfo<>(HeavenlyBoon.class, "Heavenly Boon", HeavenlyBoon::new)
.scoreboardId("HeavenlyBoon")
.shorthandName("HB")
.descriptions(
"Whenever you are hit with a positive splash potion, the effects are also given to other players in a 12 block radius. In addition, whenever an undead mob you have hit within 1.5s dies or you deal damage to a boss (R1 100/R2 200/R3 300), you have a 10% chance to be splashed with an 20% Instant Health potion, with an additional effect of either Regen I, +10% Strength, +10% Resistance, +20% Speed, or +20% Absorption with a 20 second duration.",
"The chance to be splashed upon killing an undead mob is increased to 20%. The effect potions now give 40% Instant Health and the durations of each are increased to 50 seconds.",
String.format(
"When a potion is created by this skill, also increase all current positive potion durations by %s%%" +
" (up to a maximum of %s hours, and up to %s times per effect) on all players in the radius.",
(int) (ENHANCEMENT_POTION_EFFECT_BONUS * 100),
ENHANCEMENT_POTION_EFFECT_MAX_DURATION / (60 * 60 * 20),
MAX_EXTENSIONS
))
.simpleDescription("Share all positive splash potion effects with nearby players and occasionally generate splash potions when killing Undead enemies.")
.displayItem(Material.SPLASH_POTION);

private static final ImmutableSet<String> BOON_DROPS = ImmutableSet.of(
"Regeneration Boon", "Speed Boon", "Strength Boon", "Absorption Boon", "Resistance Boon",
"Regeneration Boon 2", "Speed Boon 2", "Strength Boon 2", "Absorption Boon 2", "Resistance Boon 2");
"Regeneration Boon", "Speed Boon", "Strength Boon", "Absorption Boon", "Resistance Boon",
"Regeneration Boon 2", "Speed Boon 2", "Strength Boon 2", "Absorption Boon 2", "Resistance Boon 2");
private static final ImmutableList<NamespacedKey> LEVEL_1_POTIONS = ImmutableList.of(
NamespacedKeyUtils.fromString("epic:items/potions/regeneration_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/absorption_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/speed_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/resistance_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/strength_boon")
NamespacedKeyUtils.fromString("epic:items/potions/regeneration_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/absorption_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/speed_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/resistance_boon"),
NamespacedKeyUtils.fromString("epic:items/potions/strength_boon")
);
private static final ImmutableList<NamespacedKey> LEVEL_2_POTIONS = ImmutableList.of(
NamespacedKeyUtils.fromString("epic:items/potions/regeneration_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/absorption_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/speed_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/resistance_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/strength_boon_2")
NamespacedKeyUtils.fromString("epic:items/potions/regeneration_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/absorption_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/speed_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/resistance_boon_2"),
NamespacedKeyUtils.fromString("epic:items/potions/strength_boon_2")
);

private final KillTriggeredAbilityTracker mTracker;
Expand All @@ -120,12 +121,12 @@ public HeavenlyBoon(Plugin plugin, Player player) {
mChance = CharmManager.getLevelPercentDecimal(player, CHARM_CHANCE) + (isLevelOne() ? HEAVENLY_BOON_1_CHANCE : HEAVENLY_BOON_2_CHANCE);
mDurationChange = CharmManager.getExtraDuration(player, CHARM_DURATION);
mPotStrengthChange = ImmutableMap.of(
"InstantHealthPercent", (isLevelOne() ? HEAVENLY_BOON_HEAL_1 : HEAVENLY_BOON_HEAL_2) * CharmManager.getLevelPercentDecimal(player, CHARM_HEAL_AMPLIFIER),
"Regeneration", CharmManager.getLevelPercentDecimal(player, CHARM_REGEN_AMPLIFIER),
"Speed", CharmManager.getLevelPercentDecimal(player, CHARM_SPEED_AMPLIFIER),
"damage", CharmManager.getLevelPercentDecimal(player, CHARM_STRENGTH_AMPLIFIER),
"Resistance", CharmManager.getLevelPercentDecimal(player, CHARM_RESIST_AMPLIFIER),
"Absorption", CharmManager.getLevelPercentDecimal(player, CHARM_ABSORPTION_AMPLIFIER)
"InstantHealthPercent", (isLevelOne() ? HEAVENLY_BOON_HEAL_1 : HEAVENLY_BOON_HEAL_2) * CharmManager.getLevelPercentDecimal(player, CHARM_HEAL_AMPLIFIER),
"Regeneration", CharmManager.getLevelPercentDecimal(player, CHARM_REGEN_AMPLIFIER),
"Speed", CharmManager.getLevelPercentDecimal(player, CHARM_SPEED_AMPLIFIER),
"damage", CharmManager.getLevelPercentDecimal(player, CHARM_STRENGTH_AMPLIFIER),
"Resistance", CharmManager.getLevelPercentDecimal(player, CHARM_RESIST_AMPLIFIER),
"Absorption", CharmManager.getLevelPercentDecimal(player, CHARM_ABSORPTION_AMPLIFIER)
);
mRadius = CharmManager.getRadius(mPlayer, CHARM_RADIUS, HEAVENLY_BOON_RADIUS);

Expand All @@ -139,7 +140,7 @@ public HeavenlyBoon(Plugin plugin, Player player) {
*/
@Override
public boolean playerSplashedByPotionEvent(Collection<LivingEntity> affectedEntities, ThrownPotion potion,
PotionSplashEvent event) {
PotionSplashEvent event) {
if (!(potion.getShooter() instanceof Player)) {
return true;
}
Expand Down Expand Up @@ -202,7 +203,9 @@ public boolean onDamage(DamageEvent event, LivingEntity enemy) {
@Override
public void triggerOnKill(LivingEntity mob) {
if (Crusade.enemyTriggersAbilities(mob, mCrusade)
&& FastUtils.RANDOM.nextDouble() < mChance) {
&& FastUtils.RANDOM.nextDouble() < mChance
&& !ServerProperties.getShardName().equals("plots")
&& !ServerProperties.getShardName().equals("playerplots")) {

ImmutableList<NamespacedKey> lootTables = isLevelOne() ? LEVEL_1_POTIONS : LEVEL_2_POTIONS;
NamespacedKey lootTable = lootTables.get(FastUtils.RANDOM.nextInt(lootTables.size()));
Expand All @@ -220,24 +223,24 @@ public void triggerOnKill(LivingEntity mob) {
mLastSuccessfulProcTick = Bukkit.getCurrentTick();
for (Player p : PlayerUtils.playersInRange(mPlayer.getLocation(), mRadius, true)) {
mPlugin.mPotionManager.modifyPotionDuration(p,
potionInfo -> {
if (potionInfo.mDuration > ENHANCEMENT_POTION_EFFECT_MAX_DURATION
|| potionInfo.mInfinite
|| potionInfo.mType == null
|| !PotionUtils.hasPositiveEffects(potionInfo.mType)
|| potionInfo.mHeavenlyBoonExtensions >= MAX_EXTENSIONS) {
return potionInfo.mDuration;
}
potionInfo.mHeavenlyBoonExtensions++;
return Math.min(potionInfo.mDuration + (int) (potionInfo.mDuration * ENHANCEMENT_POTION_EFFECT_BONUS), ENHANCEMENT_POTION_EFFECT_MAX_DURATION);
});
potionInfo -> {
if (potionInfo.mDuration > ENHANCEMENT_POTION_EFFECT_MAX_DURATION
|| potionInfo.mInfinite
|| potionInfo.mType == null
|| !PotionUtils.hasPositiveEffects(potionInfo.mType)
|| potionInfo.mHeavenlyBoonExtensions >= MAX_EXTENSIONS) {
return potionInfo.mDuration;
}
potionInfo.mHeavenlyBoonExtensions++;
return Math.min(potionInfo.mDuration + (int) (potionInfo.mDuration * ENHANCEMENT_POTION_EFFECT_BONUS), ENHANCEMENT_POTION_EFFECT_MAX_DURATION);
});
List<Effect> effects = mPlugin.mEffectManager.getEffects(p);
if (effects != null) {
for (Effect e : effects) {
if (e.isBuff()
&& (e.getDuration() < ENHANCEMENT_POTION_EFFECT_MAX_DURATION
&& e.getDuration() != PotionEffect.INFINITE_DURATION)
&& EffectType.isEffectTypeAppliedEffect(mPlugin.mEffectManager.getSource(mPlayer, e))
&& (e.getDuration() < ENHANCEMENT_POTION_EFFECT_MAX_DURATION
&& e.getDuration() != PotionEffect.INFINITE_DURATION)
&& EffectType.isEffectTypeAppliedEffect(mPlugin.mEffectManager.getSource(mPlayer, e))
&& e.getHeavenlyBoonExtensions() < MAX_EXTENSIONS) {
e.incrementHeavenlyBoonExtensions();
e.setDuration(Math.min(e.getDuration() + (int) (e.getDuration() * ENHANCEMENT_POTION_EFFECT_BONUS), ENHANCEMENT_POTION_EFFECT_MAX_DURATION));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
import com.playmonumenta.plugins.bosses.bosses.SerializedLocationBossAbilityGroup;
import com.playmonumenta.plugins.bosses.spells.Spell;
import com.playmonumenta.plugins.bosses.spells.SpellBasePassiveAbility;
import com.playmonumenta.plugins.bosses.spells.sirius.*;
import com.playmonumenta.plugins.bosses.spells.sirius.PassiveDeclaration;
import com.playmonumenta.plugins.bosses.spells.sirius.PassiveStarBlight;
import com.playmonumenta.plugins.bosses.spells.sirius.PassiveStarBlightConversion;
import com.playmonumenta.plugins.bosses.spells.sirius.PassiveTentacleManager;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellBlightBomb;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellBlightWall;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellBlightedBolts;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellBlightedPods;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellCosmicPortals;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellFromTheStars;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellSiriusBeams;
import com.playmonumenta.plugins.bosses.spells.sirius.SpellSummonTheStars;
import com.playmonumenta.plugins.effects.CustomTimerEffect;
import com.playmonumenta.plugins.effects.Effect;
import com.playmonumenta.plugins.effects.EffectManager;
Expand All @@ -18,7 +29,12 @@
import com.playmonumenta.plugins.particle.PPCircle;
import com.playmonumenta.plugins.particle.PPLine;
import com.playmonumenta.plugins.particle.PartialParticle;
import com.playmonumenta.plugins.utils.*;
import com.playmonumenta.plugins.utils.BossUtils;
import com.playmonumenta.plugins.utils.DamageUtils;
import com.playmonumenta.plugins.utils.EntityUtils;
import com.playmonumenta.plugins.utils.FastUtils;
import com.playmonumenta.plugins.utils.LocationUtils;
import com.playmonumenta.plugins.utils.PlayerUtils;
import com.playmonumenta.scriptedquests.utils.MessagingUtils;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -27,14 +43,27 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.*;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.World;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.AmethystCluster;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.entity.*;
import org.bukkit.entity.BlockDisplay;
import org.bukkit.entity.Display;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -142,7 +171,7 @@ public Sirius(Plugin plugin, LivingEntity boss, Location spawnLoc, Location endL
mStarBlightConverter
);
SpellManager spells = new SpellManager(List.of(
new SpellBlightWall(plugin, this),
new SpellBlightWall(plugin, this, declarations),
new SpellBlightBomb(this, plugin, mStarBlightConverter),
new SpellCosmicPortals(this, plugin),
new SpellFromTheStars(this, plugin, mTentacleManager, declarations),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,28 @@
public class SiriusMeleeBoss extends BossAbilityGroup {
public static final String identityTag = "boss_siriusmeleeboss";
private @Nullable PassiveStarBlightConversion mConverter;
private @Nullable Sirius mSirius;
private static final int DETECTIONRANGE = 80;

public SiriusMeleeBoss(Plugin plugin, LivingEntity boss) {
super(plugin, identityTag, boss);
List<LivingEntity> mobs = EntityUtils.getNearbyMobs(mBoss.getLocation(), 100, EnumSet.of(EntityType.SLIME));
for (LivingEntity mob : mobs) {
if (mob.getScoreboardTags().contains(Sirius.identityTag)) {
Sirius mSirius = BossUtils.getBossOfClass(mob, Sirius.class);
if (mSirius == null) {
Sirius sirius = BossUtils.getBossOfClass(mob, Sirius.class);
if (sirius == null) {
MMLog.warning("SiriusMeleeBoss: Didn't find Sirius! (Likely bug)");
} else {
mConverter = mSirius.mStarBlightConverter;
mConverter = sirius.mStarBlightConverter;
mSirius = sirius;
}
}
}

if (mConverter != null) {
if (mConverter != null && mSirius != null) {
SpellManager activeSpells = new SpellManager(List.of(
new SpellSwordCleave(plugin, mConverter, mBoss),
new SpellStarblightCharge(plugin, mBoss, mConverter)
new SpellStarblightCharge(plugin, mBoss, mConverter, mSirius)
));

List<Spell> passiveSpells = List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

import com.playmonumenta.plugins.bosses.bosses.sirius.Sirius;
import com.playmonumenta.plugins.bosses.spells.Spell;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.*;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationAurora;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationBarrage;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationDamage;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationMobs;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationPoints;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclarationTp;
import com.playmonumenta.plugins.bosses.spells.sirius.declaration.DeclerationTuulen;
import com.playmonumenta.plugins.utils.FastUtils;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -18,6 +24,7 @@ public class PassiveDeclaration extends Spell {
public boolean mSwapping;
public List<Spell> mDeclerations;
public Sirius mSirius;
public boolean mTp;
private boolean mOnCooldown;
private boolean mFirstRun;
private Plugin mPlugin;
Expand All @@ -27,6 +34,7 @@ public PassiveDeclaration(Plugin plugin, Sirius sirius, PassiveStarBlightConvers
mSirius = sirius;
mSwapping = false;
mFirstRun = true;
mTp = false;
mDeclerations = new ArrayList<>();
mPlugin = plugin;
//Less common as they are more powerful
Expand Down Expand Up @@ -57,6 +65,7 @@ public void run() {
return;
}
if (!mOnCooldown && !mSirius.mCheeseLock) {
mTp = false;
for (Player p : mSirius.getPlayersInArena(false)) {
p.playSound(p, Sound.ENTITY_ELDER_GUARDIAN_CURSE, SoundCategory.HOSTILE, 1.2f, 0.1f);
p.playSound(p, Sound.ENTITY_ALLAY_DEATH, SoundCategory.HOSTILE, 0.4f, 0.1f);
Expand All @@ -83,6 +92,9 @@ public void run() {
while (mLastSpell.getClass().equals(declaration.getClass()) || (declaration.getClass().equals(DeclarationBarrage.class) && mSirius.mDamagePhase)) {
declaration = FastUtils.getRandomElement(mDeclerations);
}
if (declaration.getClass() == DeclarationTp.class) {
mTp = true;
}
declaration.run();
mLastSpell = declaration;
}
Expand Down
Loading

0 comments on commit 0ed41dc

Please sign in to comment.