-
-
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.
- Loading branch information
Showing
14 changed files
with
312 additions
and
25 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
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
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
110 changes: 110 additions & 0 deletions
110
src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LeechBomb.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,110 @@ | ||
package io.github.sefiraat.crystamaehistoria.magic.spells.tier1; | ||
|
||
import io.github.sefiraat.crystamaehistoria.magic.CastInformation; | ||
import io.github.sefiraat.crystamaehistoria.magic.spells.core.MagicProjectile; | ||
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.FiendGoal; | ||
import io.github.sefiraat.crystamaehistoria.utils.mobgoals.LeechGoal; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.Particle; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Mob; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import java.util.UUID; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public class LeechBomb extends Spell { | ||
|
||
public LeechBomb() { | ||
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(5, true, 0, false, 50, true) | ||
.makeProjectileSpell(this::fireProjectile, 0, false, 0, false) | ||
.makeProjectileVsEntitySpell(this::eggHit) | ||
.makeProjectileVsBlockSpell(this::eggHit); | ||
setSpellCore(spellCoreBuilder.build()); | ||
} | ||
|
||
@ParametersAreNonnullByDefault | ||
public void fireProjectile(CastInformation castInformation) { | ||
Location location = castInformation.getCastLocation(); | ||
Location aimLocation = location.clone().add(0, 1.5, 0).add(location.getDirection().multiply(1)); | ||
MagicProjectile magicProjectile = SpellUtils.summonMagicProjectile(castInformation, EntityType.EGG, aimLocation); | ||
magicProjectile.setVelocity(location.getDirection(), 1.5); | ||
} | ||
|
||
@ParametersAreNonnullByDefault | ||
public void eggHit(CastInformation castInformation) { | ||
final UUID caster = castInformation.getCaster(); | ||
final Location location = castInformation.getProjectileLocation(); | ||
for (int i = 0; i < castInformation.getStaveLevel() * 2; i++) { | ||
final Location spawnLocation = location.clone().add( | ||
ThreadLocalRandom.current().nextDouble(-1, 1), | ||
0, | ||
ThreadLocalRandom.current().nextDouble(-1, 1) | ||
); | ||
SpellUtils.summonTemporaryMob( | ||
EntityType.SILVERFISH, | ||
caster, | ||
spawnLocation, | ||
new LeechGoal(caster), | ||
(60 * castInformation.getStaveLevel()), | ||
this::onTick | ||
); | ||
} | ||
} | ||
|
||
public void onTick(MagicSummon magicSummon) { | ||
Mob mob = magicSummon.getMob(); | ||
Player player = magicSummon.getPlayer(); | ||
Block block = player.getLocation().subtract(0, 0.5, 0).getBlock(); | ||
if (!player.getWorld().equals(mob.getWorld()) | ||
|| (mob.getLocation().distance(player.getLocation()) > 50 && block.getType().isSolid()) | ||
) { | ||
mob.teleport(player.getLocation()); | ||
} | ||
displayParticleEffect(magicSummon.getMob(), Particle.SPORE_BLOSSOM_AIR, 1, 1); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getId() { | ||
return "LEECH_BOMB"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String[] getLore() { | ||
return new String[]{ | ||
"Throws an egg filled with viscous", | ||
"leeches that will attack your enemies." | ||
}; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Material getMaterial() { | ||
return Material.CARVED_PUMPKIN; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public SpellRecipe getRecipe() { | ||
return new SpellRecipe( | ||
1, | ||
StoryType.MECHANICAL, | ||
StoryType.HUMAN, | ||
StoryType.ANIMAL | ||
); | ||
} | ||
|
||
} |
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
97 changes: 97 additions & 0 deletions
97
src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SummonGolem.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,97 @@ | ||
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.GolemGoal; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.Particle; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.Mob; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
import java.util.UUID; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public class SummonGolem extends Spell { | ||
|
||
public SummonGolem() { | ||
SpellCoreBuilder spellCoreBuilder = new SpellCoreBuilder(5, true, 0, false, 50, true) | ||
.makeInstantSpell(this::cast); | ||
setSpellCore(spellCoreBuilder.build()); | ||
} | ||
|
||
@ParametersAreNonnullByDefault | ||
public void cast(CastInformation castInformation) { | ||
final UUID caster = castInformation.getCaster(); | ||
final Location location = castInformation.getCastLocation(); | ||
final Location spawnLocation = location.clone().add( | ||
ThreadLocalRandom.current().nextDouble(-3, 3), | ||
0, | ||
ThreadLocalRandom.current().nextDouble(-3, 3) | ||
); | ||
SpellUtils.summonTemporaryMob( | ||
EntityType.IRON_GOLEM, | ||
caster, | ||
spawnLocation, | ||
new GolemGoal(caster), | ||
200 + (100 * castInformation.getStaveLevel()), | ||
this::onTick | ||
); | ||
} | ||
|
||
public void onTick(MagicSummon magicSummon) { | ||
Mob mob = magicSummon.getMob(); | ||
Player player = magicSummon.getPlayer(); | ||
Block block = player.getLocation().subtract(0, 0.5, 0).getBlock(); | ||
if (!player.getWorld().equals(mob.getWorld()) | ||
|| (mob.getLocation().distance(player.getLocation()) > 50 && block.getType().isSolid()) | ||
) { | ||
mob.teleport(player.getLocation()); | ||
} | ||
displayParticleEffect(magicSummon.getMob(), Particle.SLIME, 1, 3); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getId() { | ||
return "SUMMON_GOLEM"; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String[] getLore() { | ||
return new String[]{ | ||
"Summons a golem that will follow you", | ||
"and protect you.", | ||
"Golems will follow you nearly anywhere." | ||
}; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Material getMaterial() { | ||
return Material.CARVED_PUMPKIN; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public SpellRecipe getRecipe() { | ||
return new SpellRecipe( | ||
1, | ||
StoryType.MECHANICAL, | ||
StoryType.HUMAN, | ||
StoryType.ANIMAL | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.