First Checkup

This commit is contained in:
Corail31
2018-02-11 22:51:13 +01:00
parent 7f7605c089
commit d0fda72a59
86 changed files with 429 additions and 428 deletions
@@ -49,11 +49,11 @@ public class ShadowWard extends Spell {
@SubscribeEvent
public static void onLivingAttackEvent(LivingAttackEvent event){
if(event.getSource() != null && event.getSource().getEntity() instanceof EntityLivingBase){
if(event.getSource() != null && event.getSource().getTrueSource() instanceof EntityLivingBase){
// There used to be a check that the target was a player here, but I don't see any reason for it.
ItemStack wand = event.getEntityLiving().getActiveItemStack();
if(wand != null && wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand
if(!wand.isEmpty() && wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand
&& WandHelper.getCurrentSpell(wand) instanceof ShadowWard && !event.getSource().isUnblockable()
&& !(event.getSource() instanceof IElementalDamage
&& ((IElementalDamage)event.getSource()).isRetaliatory())){
@@ -61,9 +61,9 @@ public class ShadowWard extends Spell {
event.setCanceled(true);
// Now we can preserve the original daage source (sort of) as long as we make it retaliatory.
event.getEntityLiving().attackEntityFrom(
MagicDamage.causeDirectMagicDamage(event.getSource().getEntity(), DamageType.MAGIC, true),
MagicDamage.causeDirectMagicDamage(event.getSource().getTrueSource(), DamageType.MAGIC, true),
event.getAmount() / 2);
((EntityLivingBase)event.getSource().getEntity()).attackEntityFrom(
((EntityLivingBase)event.getSource().getTrueSource()).attackEntityFrom(
MagicDamage.causeDirectMagicDamage(event.getEntityLiving(), DamageType.MAGIC, true),
event.getAmount() / 2);
}