Search in sources :

Example 1 with CombatDamageSource

use of jackiecrazy.wardance.api.CombatDamageSource in project WarDance by Jackiecrazy.

the class LichtenbergScar method performEffect.

@Override
protected void performEffect(LivingEntity caster, LivingEntity target, int stack, SkillData sd) {
    DamageSource cds = new CombatDamageSource("lightningBolt", caster).setDamageTyping(CombatDamageSource.TYPE.MAGICAL).setSkillUsed(this).setProcSkillEffects(true).setProxy(target).bypassArmor();
    if (stack != 3) {
        target.hurt(cds, 0);
        return;
    }
    final float radius = 30;
    final List<LivingEntity> list = caster.level.getLoadedEntitiesOfClass(LivingEntity.class, caster.getBoundingBox().inflate(radius), (a) -> Marks.getCap(a).isMarked(this));
    list.add(target);
    // float damage = s.getArbitraryFloat() * (1 + CombatData.getCap(caster).getSpirit());
    for (LivingEntity baddie : list) {
        if (baddie == target)
            target.hurt(cds, target.getHealth() / 5);
        else
            baddie.hurt(cds, baddie.getHealth() / 10);
        LightningBoltEntity lightningboltentity = EntityType.LIGHTNING_BOLT.create(target.level);
        lightningboltentity.moveTo(baddie.getX(), baddie.getY(), baddie.getZ());
        lightningboltentity.setVisualOnly(true);
        target.level.addFreshEntity(lightningboltentity);
        if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(baddie, lightningboltentity))
            baddie.thunderHit((ServerWorld) baddie.level, lightningboltentity);
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ServerWorld(net.minecraft.world.server.ServerWorld) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource) DamageSource(net.minecraft.util.DamageSource) LightningBoltEntity(net.minecraft.entity.effect.LightningBoltEntity) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource)

Example 2 with CombatDamageSource

use of jackiecrazy.wardance.api.CombatDamageSource in project WarDance by Jackiecrazy.

the class ViralDecay method detonate.

private static void detonate(LivingEntity target, LivingEntity caster) {
    Marks.getCap(target).removeMark(WarSkills.VIRAL_DECAY.get());
    target.hurt(new CombatDamageSource("player", caster).setDamageTyping(CombatDamageSource.TYPE.PHYSICAL).setProcSkillEffects(true).setProcAttackEffects(true).setDamageTyping(CombatDamageSource.TYPE.TRUE).bypassArmor().bypassMagic(), target.getHealth() / 10);
    SkillUtils.createCloud(target.level, caster, target.getX(), target.getY(), target.getZ(), 3, ParticleTypes.EXPLOSION);
    final List<LivingEntity> list = target.level.getLoadedEntitiesOfClass(LivingEntity.class, target.getBoundingBox().inflate(3), (b) -> !TargetingUtils.isAlly(b, caster));
    for (LivingEntity enemy : list) {
        if (enemy == target)
            continue;
        enemy.hurt(VIRUS, 2);
        Marks.getCap(enemy).mark(new SkillData(WarSkills.VIRAL_DECAY.get(), 6).setArbitraryFloat(1).setCaster(caster));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) SkillData(jackiecrazy.wardance.skill.SkillData) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource)

Example 3 with CombatDamageSource

use of jackiecrazy.wardance.api.CombatDamageSource in project WarDance by Jackiecrazy.

the class Kick method onStateChange.

@Override
public boolean onStateChange(LivingEntity caster, SkillData prev, STATE from, STATE to) {
    LivingEntity target = GeneralUtils.raytraceLiving(caster, distance());
    if (from == STATE.HOLSTERED && to == STATE.ACTIVE && target != null && cast(caster, -999)) {
        CombatData.getCap(target).consumePosture(caster, 4);
        if (caster instanceof PlayerEntity)
            ((PlayerEntity) caster).sweepAttack();
        additionally(caster, target);
        target.hurt(new CombatDamageSource("fallingBlock", caster).setDamageTyping(CombatDamageSource.TYPE.PHYSICAL).setProcSkillEffects(true).setProcAttackEffects(true), 2);
        if (target.getLastHurtByMob() == null)
            target.setLastHurtByMob(caster);
        caster.level.playSound(null, caster.getX(), caster.getY(), caster.getZ(), SoundEvents.ZOMBIE_ATTACK_WOODEN_DOOR, SoundCategory.PLAYERS, 0.25f + WarDance.rand.nextFloat() * 0.5f, 0.5f + WarDance.rand.nextFloat() * 0.5f);
    }
    if (to == STATE.COOLING) {
        setCooldown(caster, prev, 4);
        return true;
    }
    return boundCast(prev, from, to);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 4 with CombatDamageSource

use of jackiecrazy.wardance.api.CombatDamageSource in project WarDance by Jackiecrazy.

the class MixinPlayerEntity method customDamageSource.

@Redirect(method = "attack", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/DamageSource;playerAttack(Lnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/util/DamageSource;"))
private DamageSource customDamageSource(PlayerEntity player) {
    CombatDamageSource d = new CombatDamageSource("player", player).setDamageDealer(player.getMainHandItem()).setAttackingHand(CombatData.getCap(player).isOffhandAttack() ? Hand.OFF_HAND : Hand.MAIN_HAND).setProcAttackEffects(true).setProcNormalEffects(true).setCrit(tempCrit).setCritDamage(tempCdmg).setDamageTyping(CombatDamageSource.TYPE.PHYSICAL);
    ds = d;
    return d;
}
Also used : CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Example 5 with CombatDamageSource

use of jackiecrazy.wardance.api.CombatDamageSource in project WarDance by Jackiecrazy.

the class Feint method hurt.

@SubscribeEvent()
public static void hurt(LivingAttackEvent e) {
    Entity seme = e.getSource().getEntity();
    LivingEntity uke = e.getEntityLiving();
    // reduce mark "cooldown", trigger capricious strike
    if (seme instanceof LivingEntity) {
        final LivingEntity caster = (LivingEntity) seme;
        final ISkillCapability cap = CasterData.getCap(caster);
        final Skill feint = cap.getEquippedVariation(SkillCategories.feint);
        if (feint != null && Marks.getCap(uke).isMarked(SkillCategories.feint)) {
            Marks.getCap(uke).getActiveMark(feint).ifPresent(a -> a.setArbitraryFloat(a.getArbitraryFloat() - 1));
            if (cap.getEquippedSkills().contains(WarSkills.CAPRICIOUS_STRIKE.get()))
                for (Skill s : cap.getEquippedSkills()) if (s != null && s.getTags(caster).contains(SkillTags.physical) && cap.getSkillState(s) == STATE.COOLING)
                    cap.getSkillData(s).ifPresent(SkillData::decrementDuration);
        }
    }
    // spirit bomb damage amplification
    Marks.getCap(uke).getActiveMark(WarSkills.SPIRIT_RESONANCE.get()).ifPresent((a) -> {
        if (a.getDuration() <= 0.1 && e.getSource() instanceof CombatDamageSource && ((CombatDamageSource) e.getSource()).canProcSkillEffects()) {
            a.flagCondition(true);
            a.setArbitraryFloat(a.getArbitraryFloat() - 1);
            a.setDuration(1.1f);
            CombatData.getCap(uke).consumePosture(2);
        }
    });
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Entity(net.minecraft.entity.Entity) LivingEntity(net.minecraft.entity.LivingEntity) ISkillCapability(jackiecrazy.wardance.capability.skill.ISkillCapability) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Aggregations

CombatDamageSource (jackiecrazy.wardance.api.CombatDamageSource)11 LivingEntity (net.minecraft.entity.LivingEntity)8 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)5 ICombatCapability (jackiecrazy.wardance.capability.resources.ICombatCapability)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)3 ServerWorld (net.minecraft.world.server.ServerWorld)3 StealthUtils (jackiecrazy.wardance.utils.StealthUtils)2 ItemStack (net.minecraft.item.ItemStack)2 ISkillCapability (jackiecrazy.wardance.capability.skill.ISkillCapability)1 ICombatItemCapability (jackiecrazy.wardance.capability.weaponry.ICombatItemCapability)1 ParryEvent (jackiecrazy.wardance.event.ParryEvent)1 ProjectileParryEvent (jackiecrazy.wardance.event.ProjectileParryEvent)1 SkillData (jackiecrazy.wardance.skill.SkillData)1 CombatUtils (jackiecrazy.wardance.utils.CombatUtils)1 Entity (net.minecraft.entity.Entity)1 AttributeModifier (net.minecraft.entity.ai.attributes.AttributeModifier)1 LightningBoltEntity (net.minecraft.entity.effect.LightningBoltEntity)1 DamageSource (net.minecraft.util.DamageSource)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1