-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RemnantOfWar, Gyroscopic, Stave recipe
- Loading branch information
Showing
5 changed files
with
283 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package io.github.sefiraat.crystamaehistoria.magic.spells.tier1; | ||
|
||
import io.github.sefiraat.crystamaehistoria.magic.CastInformation; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.Spell; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.SpellCoreBuilder; | ||
import io.github.sefiraat.crystamaehistoria.slimefun.machines.liquefactionbasin.SpellRecipe; | ||
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType; | ||
import io.github.sefiraat.crystamaehistoria.utils.Keys; | ||
import io.github.thebusybiscuit.slimefun4.libraries.dough.data.persistent.PersistentDataAPI; | ||
import io.github.thebusybiscuit.slimefun4.libraries.dough.protection.Interaction; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.Particle; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Mob; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
public class Gyroscopic extends Spell { | ||
|
||
public Gyroscopic() { | ||
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(40, true, 15, false, 50, true) | ||
.makeTickingSpell(this::cast, 20, true, 5, false); | ||
setSpellCore(spellCoreBuilder.build()); | ||
} | ||
|
||
@ParametersAreNonnullByDefault | ||
public void cast(CastInformation castInformation) { | ||
final Location location = castInformation.getCasterAsPlayer().getLocation().clone().add(0, 1, 0); | ||
final double range = getRange(castInformation); | ||
final double effectRange = range * 0.75; | ||
final int density = 30; | ||
// Particles | ||
for (double height = 0; height <= Math.PI; height += Math.PI / density) { | ||
final double r = range * Math.sin(height); | ||
final double y = range * Math.cos(height); | ||
for (double a = 0; a < Math.PI * 2; a += Math.PI / density) { | ||
final double x = Math.cos(a) * r; | ||
final double z = Math.sin(a) * r; | ||
final Location point = location.clone().add(x, y, z); | ||
displayParticleEffect(point, Particle.GLOW, 0.1, 1); | ||
} | ||
} | ||
for (Entity entity : location.getWorld().getNearbyEntities(location, effectRange, effectRange, effectRange)) { | ||
if (entity instanceof LivingEntity | ||
&& hasPermission(castInformation.getCaster(), entity.getLocation(), Interaction.INTERACT_ENTITY) | ||
&& entity.getUniqueId() != castInformation.getCaster() | ||
) { | ||
// Todo mobs dont spin? | ||
Location newLocation = entity.getLocation().clone(); | ||
newLocation.setYaw(entity.getLocation().getYaw() + 10F); | ||
entity.teleport(newLocation); | ||
displayParticleEffect(entity, Particle.SPELL, 1, 1); | ||
} | ||
} | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getId() { | ||
return "GYROSCOPIC"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String[] getLore() { | ||
return new String[]{ | ||
"You spin me right round baby..." | ||
}; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Material getMaterial() { | ||
return Material.MUSIC_DISC_CAT; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public SpellRecipe getRecipe() { | ||
return new SpellRecipe( | ||
1, | ||
StoryType.MECHANICAL, | ||
StoryType.ANIMAL, | ||
StoryType.CELESTIAL | ||
); | ||
} | ||
} |
142 changes: 142 additions & 0 deletions
142
src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RemnantOfWar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package io.github.sefiraat.crystamaehistoria.magic.spells.tier1; | ||
|
||
import io.github.sefiraat.crystamaehistoria.magic.CastInformation; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.MagicSummon; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.Spell; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.SpellCoreBuilder; | ||
import io.github.sefiraat.crystamaehistoria.slimefun.machines.liquefactionbasin.SpellRecipe; | ||
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType; | ||
import io.github.sefiraat.crystamaehistoria.utils.SpellUtils; | ||
import io.github.sefiraat.crystamaehistoria.utils.mobgoals.BoringGoal; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.Particle; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Zombie; | ||
import org.bukkit.inventory.EntityEquipment; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import java.util.UUID; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public class RemnantOfWar extends Spell { | ||
|
||
public RemnantOfWar() { | ||
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(5, true, 0, false, 50, true) | ||
.makeInstantSpell(this::cast); | ||
setSpellCore(spellCoreBuilder.build()); | ||
} | ||
|
||
@ParametersAreNonnullByDefault | ||
public void cast(CastInformation castInformation) { | ||
UUID caster = castInformation.getCaster(); | ||
Location location = castInformation.getCastLocation(); | ||
Location spawnLocation = location.clone().add( | ||
ThreadLocalRandom.current().nextDouble(-3,3), | ||
0, | ||
ThreadLocalRandom.current().nextDouble(-3,3) | ||
); | ||
MagicSummon magicSummon = SpellUtils.summonTemporaryMob( | ||
EntityType.ZOMBIE, | ||
caster, | ||
spawnLocation, | ||
new BoringGoal(caster), | ||
180, | ||
this::onTick | ||
); | ||
Zombie zombie = (Zombie) magicSummon.getMob(); | ||
gearZombie(zombie, castInformation.getStaveLevel()); | ||
} | ||
|
||
public void gearZombie(Zombie zombie, int tier) { | ||
ItemStack helmet; | ||
ItemStack chestplate; | ||
ItemStack leggings; | ||
ItemStack boots; | ||
ItemStack sword; | ||
switch (tier) { | ||
case 1: | ||
helmet = new ItemStack(Material.LEATHER_HELMET); | ||
chestplate = new ItemStack(Material.LEATHER_CHESTPLATE); | ||
leggings = new ItemStack(Material.LEATHER_LEGGINGS); | ||
boots = new ItemStack(Material.LEATHER_BOOTS); | ||
sword = new ItemStack(Material.WOODEN_SWORD); | ||
break; | ||
case 2: | ||
helmet = new ItemStack(Material.CHAINMAIL_HELMET); | ||
chestplate = new ItemStack(Material.CHAINMAIL_CHESTPLATE); | ||
leggings = new ItemStack(Material.CHAINMAIL_LEGGINGS); | ||
boots = new ItemStack(Material.CHAINMAIL_BOOTS); | ||
sword = new ItemStack(Material.STONE_SWORD); | ||
break; | ||
case 3: | ||
helmet = new ItemStack(Material.IRON_HELMET); | ||
chestplate = new ItemStack(Material.IRON_CHESTPLATE); | ||
leggings = new ItemStack(Material.IRON_LEGGINGS); | ||
boots = new ItemStack(Material.IRON_BOOTS); | ||
sword = new ItemStack(Material.IRON_SWORD); | ||
break; | ||
case 4: | ||
helmet = new ItemStack(Material.DIAMOND_HELMET); | ||
chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE); | ||
leggings = new ItemStack(Material.DIAMOND_LEGGINGS); | ||
boots = new ItemStack(Material.DIAMOND_BOOTS); | ||
sword = new ItemStack(Material.DIAMOND_SWORD); | ||
break; | ||
case 5: | ||
helmet = new ItemStack(Material.NETHERITE_HELMET); | ||
chestplate = new ItemStack(Material.NETHERITE_CHESTPLATE); | ||
leggings = new ItemStack(Material.NETHERITE_LEGGINGS); | ||
boots = new ItemStack(Material.NETHERITE_BOOTS); | ||
sword = new ItemStack(Material.NETHERITE_SWORD); | ||
break; | ||
default: | ||
throw new IllegalStateException("Unexpected value: " + tier); | ||
} | ||
EntityEquipment entityEquipment = zombie.getEquipment(); | ||
entityEquipment.setHelmet(helmet); | ||
entityEquipment.setChestplate(chestplate); | ||
entityEquipment.setLeggings(leggings); | ||
entityEquipment.setBoots(boots); | ||
entityEquipment.setItemInMainHand(sword); | ||
} | ||
|
||
public void onTick(MagicSummon magicSummon) { | ||
displayParticleEffect(magicSummon.getMob(), Particle.SOUL, 1, 1); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getId() { | ||
return "REMNANT_OF_WAR"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String[] getLore() { | ||
return new String[]{ | ||
"Summons a remnant of war from the dead", | ||
"to your side. Their gear scales with tier." | ||
}; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Material getMaterial() { | ||
return Material.ZOMBIE_SPAWN_EGG; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public SpellRecipe getRecipe() { | ||
return new SpellRecipe( | ||
1, | ||
StoryType.HISTORICAL, | ||
StoryType.HUMAN, | ||
StoryType.VOID | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters