Skip to content

Commit

Permalink
Add Charged Ring of Shielding
Browse files Browse the repository at this point in the history
Has a different functionality compared to the original.
  • Loading branch information
IcarussOne committed Aug 30, 2024
1 parent c727894 commit d5bc7f6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/mod/icarus/crimsonrevelations/events/CREvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@EventBusSubscriber(modid = NewCrimsonRevelations.MODID)
@GameRegistry.ObjectHolder(NewCrimsonRevelations.MODID)
public class CREvents {
// TODO: Custom sounds
@SubscribeEvent
public static void onHurtEvent(LivingHurtEvent event) {
World world = event.getEntity().world;
Expand All @@ -31,9 +32,10 @@ public static void onHurtEvent(LivingHurtEvent event) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
int charge = (int) player.getAbsorptionAmount();

// Kinetic Girdle of Shielding - Explodes when the Runic Shielding is pierced (20 second cooldown).
if (charge > 0) {
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicGirdleKinetic) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicGirdleKinetic))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.poof, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.createExplosion(player, player.posX, player.posY + player.height / 2.0F, player.posZ, 2.0F, false);

List<Entity> entities = player.world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().grow(3.0D, 3.0D, 3.0D));
Expand All @@ -49,6 +51,7 @@ public static void onHurtEvent(LivingHurtEvent event) {
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicGirdleKinetic, 20 * 20);
}

// Revitalizing Ring of Shielding - Gives 6 seconds of Regeneration II when the Runic Shielding is pierced (20 second cooldown).
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicRingRegen) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingRegen))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6 * 20, 1, true, true));
Expand All @@ -57,13 +60,22 @@ public static void onHurtEvent(LivingHurtEvent event) {
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicRingRegen, 20 * 20);
}

// Amulet of Emergency Shielding - Gives 8 points of Runic Shielding when the Runic Shielding is pierced (1 minute cooldown). [WIP]
if (charge <= event.getAmount() && BaublesApi.isBaubleEquipped(player, CRItems.runicAmuletEmergency) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicAmuletEmergency))) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.egscreech, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.setAbsorptionAmount(charge + 8);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicAmuletEmergency));
((EntityPlayer) player).getCooldownTracker().setCooldown(CRItems.runicAmuletEmergency, 60 * 20);
}

// Charged Ring of Shielding - 25% chance to instantly restore the Runic Shielding lost from damage.
if (BaublesApi.isBaubleEquipped(player, CRItems.runicRingCharged) > 0 && !(player.getCooldownTracker().hasCooldown(CRItems.runicRingCharged)) && player.world.rand.nextDouble() <= 0.25D) {
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundsTC.runicShieldEffect, SoundCategory.PLAYERS, 1.0F, 1.0F + (float) player.getEntityWorld().rand.nextGaussian() * 0.05F);
player.setAbsorptionAmount(charge + 1);

((EntityPlayer) player).addStat(StatList.getObjectUseStats(CRItems.runicRingCharged));
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/mod/icarus/crimsonrevelations/init/CRItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class CRItems {
public static Item runicGirdleKinetic;
@GameRegistry.ObjectHolder("runic_ring")
public static Item runicRing;
@GameRegistry.ObjectHolder("runic_ring_charged")
public static Item runicRingCharged;
@GameRegistry.ObjectHolder("runic_ring_regen")
public static Item runicRingRegen;

Expand Down Expand Up @@ -124,6 +126,7 @@ public static void registerItems(@Nonnull final RegistryEvent.Register<Item> eve
CRRegistry.setup(new CRItemRunicBauble(BaubleType.RING, EnumRarity.UNCOMMON, 5), "runic_ring"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.AMULET, EnumRarity.UNCOMMON, 8), "runic_amulet"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.BELT, EnumRarity.UNCOMMON, 10), "runic_girdle"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.RING, EnumRarity.RARE, 4), "runic_ring_charged"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.RING, EnumRarity.RARE, 4), "runic_ring_regen"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.AMULET, EnumRarity.RARE, 7), "runic_amulet_emergency"),
CRRegistry.setup(new CRItemRunicBauble(BaubleType.BELT, EnumRarity.RARE, 9), "runic_girdle_kinetic"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ item.crimsonrevelations.runic_amulet_emergency.name=Amulet of Emergency Shieldin
item.crimsonrevelations.runic_girdle.name=Belt of Runic Shielding
item.crimsonrevelations.runic_girdle_kinetic.name=Kinetic Girdle of Shielding
item.crimsonrevelations.runic_ring.name=Ring of Runic Shielding
item.crimsonrevelations.runic_ring_charged.name=Charged Ring of Shielding
item.crimsonrevelations.runic_ring_regen.name=Revitalizing Ring of Shielding
item.crimsonrevelations.terra_arrow.name=Terra Arrow

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "crimsonrevelations:items/runic_ring_charged"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}

0 comments on commit d5bc7f6

Please sign in to comment.