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);
}
}
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));
}
}
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);
}
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;
}
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);
}
});
}
Aggregations