Add mirage spell
This commit is contained in:
@@ -210,6 +210,12 @@ public final class WizardryEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// Mirage
|
||||
if(event.getTarget().isPotionActive(WizardryPotions.mirage)){
|
||||
// Can't find players under mirage at all! (Pretty sure this excludes revenge-targeting)
|
||||
((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
|
||||
}
|
||||
|
||||
// Blindness tweak
|
||||
// I'm not going as far as potion core's implementation, this is just so it does *something* to mobs
|
||||
if(event.getEntityLiving().isPotionActive(MobEffects.BLINDNESS) && !Loader.isModLoaded("potioncore")
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package electroblob.wizardry.client.renderer.effect;
|
||||
|
||||
import electroblob.wizardry.registry.WizardryPotions;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@EventBusSubscriber(Side.CLIENT)
|
||||
public class RenderMirage {
|
||||
|
||||
private static final int BLINK_PERIOD_1 = 47; // Use two prime numbers to make it look as chaotic as possible
|
||||
private static final int BLINK_PERIOD_2 = 71;
|
||||
|
||||
private static final double MAX_OFFSET = 3;
|
||||
|
||||
private static final Random random = new Random(); // Seed will be set later
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderLivingEvent(RenderLivingEvent.Pre<?> event){
|
||||
if(event.getEntity().isPotionActive(WizardryPotions.mirage)){
|
||||
random.setSeed(event.getEntity().ticksExisted / BLINK_PERIOD_1
|
||||
+ event.getEntity().ticksExisted / BLINK_PERIOD_2);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); // GhoOOoOostly OooOOOo00oOOo
|
||||
GlStateManager.color(1, 1, 1, 0.5f);
|
||||
GlStateManager.translate((random.nextDouble() * 2 - 1) * MAX_OFFSET,
|
||||
(random.nextDouble() * 2 - 1) * MAX_OFFSET, (random.nextDouble() * 2 - 1) * MAX_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderLivingEvent(RenderLivingEvent.Post<?> event){
|
||||
if(event.getEntity().isPotionActive(WizardryPotions.mirage)){
|
||||
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -468,6 +468,7 @@ public final class Spells {
|
||||
registry.register(new WitheringTotem());
|
||||
registry.register(new Fangs());
|
||||
registry.register(new GuardianBeam());
|
||||
registry.register(new SpellBuff("mirage", 0.64f, 0.47f, 0.9f, () -> WizardryPotions.mirage));
|
||||
registry.register(new RadiantTotem());
|
||||
|
||||
registry.register(new Firestorm());
|
||||
|
||||
@@ -56,6 +56,7 @@ public final class WizardryPotions {
|
||||
public static final Potion containment = placeholder();
|
||||
public static final Potion frost_step = placeholder();
|
||||
public static final Potion mark_of_sacrifice = placeholder();
|
||||
public static final Potion mirage = placeholder();
|
||||
|
||||
/**
|
||||
* Sets both the registry and unlocalised names of the given potion, then registers it with the given registry. Use
|
||||
@@ -194,6 +195,12 @@ public final class WizardryPotions {
|
||||
registerPotion(registry, "mark_of_sacrifice", new PotionMagicEffect(true, 0xe90e48,
|
||||
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mark_of_sacrifice.png")));
|
||||
|
||||
registerPotion(registry, "mirage", new PotionMagicEffectParticles(false, 0, // No particles or we'll see the player's actual position!
|
||||
new ResourceLocation(Wizardry.MODID, "textures/gui/potion_icons/mirage.png")){
|
||||
@Override
|
||||
public void spawnCustomParticle(World world, double x, double y, double z){} // We only want the syncing
|
||||
}.setBeneficial());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -891,6 +891,7 @@ spell.ebwizardry\:meteor=Meteor
|
||||
spell.ebwizardry\:mind_control=Mind Control
|
||||
spell.ebwizardry\:mind_trick=Mind Trick
|
||||
spell.ebwizardry\:mine=Mine
|
||||
spell.ebwizardry\:mirage=Mirage
|
||||
spell.ebwizardry\:muffle=Muffle
|
||||
spell.ebwizardry\:none=[Empty Slot]
|
||||
spell.ebwizardry\:oakflesh=Oakflesh
|
||||
@@ -1078,6 +1079,7 @@ spell.ebwizardry\:meteor.desc=Some wizards just want to see the world burn...
|
||||
spell.ebwizardry\:mind_control.desc=Takes control of the target's mind for 30 seconds, causing it switch sides and fight for the caster instead. Will not work on creatures that are too strong-willed.
|
||||
spell.ebwizardry\:mind_trick.desc=Confuses and disorients the target for 15 seconds, rendering it unable to attack effectively. The effect will be dispelled if the target takes damage.
|
||||
spell.ebwizardry\:mine.desc=Breaks the block the caster is looking at. Potency will allow harder blocks to be broken.
|
||||
spell.ebwizardry\:mirage.desc=Creates an illusion where the caster appears to be a few blocks away from their actual position, blinking around every few seconds. The illusion lasts for 20 seconds.
|
||||
spell.ebwizardry\:muffle.desc=Silences any sounds made by the caster for 30 seconds. When muffled, mobs can only detect you when looking towards you.
|
||||
spell.ebwizardry\:none.desc=To get a spell book with the /give command, use id\: /give [player] ebwizardry\:spell_book 1 [spell id] (if you found this book in a chest, some other mod has messed things up).
|
||||
spell.ebwizardry\:oakflesh.desc=Improves the caster's damage resistance for 30 seconds.
|
||||
@@ -1251,6 +1253,7 @@ potion.ebwizardry\:curse_of_enfeeblement=Curse of Enfeeblement
|
||||
potion.ebwizardry\:curse_of_undeath=Curse of Undeath
|
||||
potion.ebwizardry\:containment=Containment
|
||||
potion.ebwizardry\:frost_step=Frost Step
|
||||
potion.ebwizardry\:mirage=Mirage
|
||||
|
||||
enchantment.ebwizardry\:magic_sword=Imbuement
|
||||
enchantment.ebwizardry\:magic_bow=Imbuement
|
||||
|
||||
@@ -891,6 +891,7 @@ spell.ebwizardry\:meteor=Meteor
|
||||
spell.ebwizardry\:mind_control=Mind Control
|
||||
spell.ebwizardry\:mind_trick=Mind Trick
|
||||
spell.ebwizardry\:mine=Mine
|
||||
spell.ebwizardry\:mirage=Mirage
|
||||
spell.ebwizardry\:muffle=Muffle
|
||||
spell.ebwizardry\:none=[Empty Slot]
|
||||
spell.ebwizardry\:oakflesh=Oakflesh
|
||||
@@ -1078,6 +1079,7 @@ spell.ebwizardry\:meteor.desc=Some wizards just want to see the world burn...
|
||||
spell.ebwizardry\:mind_control.desc=Takes control of the target's mind for 30 seconds, causing it switch sides and fight for the caster instead. Will not work on creatures that are too strong-willed.
|
||||
spell.ebwizardry\:mind_trick.desc=Confuses and disorients the target for 15 seconds, rendering it unable to attack effectively. The effect will be dispelled if the target takes damage.
|
||||
spell.ebwizardry\:mine.desc=Breaks the block the caster is looking at. Potency will allow harder blocks to be broken.
|
||||
spell.ebwizardry\:mirage.desc=Creates an illusion where the caster appears to be a few blocks away from their actual position, blinking around every few seconds. The illusion lasts for 20 seconds.
|
||||
spell.ebwizardry\:muffle.desc=Silences any sounds made by the caster for 30 seconds. When muffled, mobs can only detect you when looking towards you.
|
||||
spell.ebwizardry\:none.desc=To get a spell book with the /give command, use id\: /give [player] ebwizardry\:spell_book 1 [spell id] (if you found this book in a chest, some other mod has messed things up).
|
||||
spell.ebwizardry\:oakflesh.desc=Improves the caster's damage resistance for 30 seconds.
|
||||
@@ -1251,6 +1253,7 @@ potion.ebwizardry\:curse_of_enfeeblement=Curse of Enfeeblement
|
||||
potion.ebwizardry\:curse_of_undeath=Curse of Undeath
|
||||
potion.ebwizardry\:containment=Containment
|
||||
potion.ebwizardry\:frost_step=Frost Step
|
||||
potion.ebwizardry\:mirage=Mirage
|
||||
|
||||
enchantment.ebwizardry\:magic_sword=Imbuement
|
||||
enchantment.ebwizardry\:magic_bow=Imbuement
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"enabled": {
|
||||
"book": true,
|
||||
"scroll": true,
|
||||
"wands": true,
|
||||
"npcs": true,
|
||||
"dispensers": true,
|
||||
"commands": true,
|
||||
"treasure": true,
|
||||
"trades": true,
|
||||
"looting": true
|
||||
},
|
||||
"tier": "advanced",
|
||||
"element": "sorcery",
|
||||
"type": "alteration",
|
||||
"cost": 40,
|
||||
"chargeup": 10,
|
||||
"cooldown": 200,
|
||||
"base_properties": {
|
||||
"mirage_duration": 400,
|
||||
"mirage_strength": 0
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Reference in New Issue
Block a user