Skip to content

Commit

Permalink
devour scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Jun 26, 2023
1 parent 9a10796 commit 41c0839
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package io.redspace.ironsspellbooks.spells.blood;

import io.redspace.ironsspellbooks.capabilities.magic.CastTargetingData;
import io.redspace.ironsspellbooks.capabilities.magic.MagicManager;
import io.redspace.ironsspellbooks.capabilities.magic.PlayerMagicData;
import io.redspace.ironsspellbooks.entity.spells.devour_jaw.DevourJaw;
import io.redspace.ironsspellbooks.spells.*;
import io.redspace.ironsspellbooks.util.ParticleHelper;
import io.redspace.ironsspellbooks.util.Utils;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;

import java.util.List;
import java.util.Optional;
@@ -42,7 +39,7 @@ public List<MutableComponent> getUniqueInfo(LivingEntity caster) {
public DevourSpell(int level) {
super(SpellType.DEVOUR_SPELL);
this.setLevel(level);
this.manaCostPerLevel = 7;
this.manaCostPerLevel = 4;
this.baseSpellPower = 6;
this.spellPowerPerLevel = 1;
this.castTime = 0;
@@ -71,7 +68,6 @@ public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagic
if (playerMagicData.getAdditionalCastData() instanceof CastTargetingData targetData) {
var targetEntity = targetData.getTarget((ServerLevel) world);
if (targetEntity != null) {
particleStream(entity.position().add(0, entity.getBbHeight() / 2, 0), entity.position().add(0, targetEntity.getBbHeight() / 2, 0), world);
targetEntity.setDeltaMovement(targetEntity.getDeltaMovement().add(targetEntity.position().subtract(entity.position()).scale(-.25f)));
targetEntity.hurtMarked = true;
DevourJaw devour = new DevourJaw(world, entity, targetEntity);
@@ -86,22 +82,12 @@ public void onCast(Level world, LivingEntity entity, PlayerMagicData playerMagic
super.onCast(world, entity, playerMagicData);
}

private void particleStream(Vec3 start, Vec3 end, Level level) {
float step = .15f;
float distance = (float) (end.distanceTo(start) / step);
Vec3 jump = end.subtract(start).normalize().scale(step);
for (int i = 0; i < distance; i++) {
Vec3 pos = start.add(jump.scale(i));
MagicManager.spawnParticles(level, ParticleHelper.BLOOD, pos.x, pos.y, pos.z, 1, 0, 0, 0, 0, false);
}
}

public float getDamage(LivingEntity caster) {
return getSpellPower(caster);
}

public int getHpBonus(LivingEntity caster) {
return 2 * (int) (1f + getSpellPower(caster) * .25f);
return 2 * (int) (getSpellPower(caster) * .25f);
}

}

0 comments on commit 41c0839

Please sign in to comment.