use of jackiecrazy.wardance.skill.SkillData 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.skill.SkillData in project WarDance by Jackiecrazy.
the class SkillCapability method nonNullGet.
private SkillData nonNullGet(Skill d) {
// if data doesn't have the skill tag, re-initialize the skill data.
SkillData data = this.data.get(d);
if (data == null) {
this.data.put(d, new SkillData(d, 0, 0));
data = this.data.get(d);
}
return data;
}
use of jackiecrazy.wardance.skill.SkillData in project WarDance by Jackiecrazy.
the class SkillCapability method changeSkillState.
@Override
public boolean changeSkillState(Skill d, Skill.STATE to) {
SkillData data = nonNullGet(d);
if (data != null)
if (data.getState() == Skill.STATE.ACTIVE) {
if (GeneralConfig.debug)
WarDance.LOGGER.debug("skill " + d + " is already active, overwriting.");
}
boolean update = d.onStateChange(dude.get(), data, data.getState(), to);
data.markDirty();
fastSync = true;
return update;
}
use of jackiecrazy.wardance.skill.SkillData in project WarDance by Jackiecrazy.
the class Mark method removeMark.
@Override
public void removeMark(Skill s) {
SkillData sd = statuus.get(s);
LivingEntity victim = dude.get();
if (sd != null && victim != null) {
sd.getSkill().onMarkEnd(sd.getCaster(victim.level), victim, sd);
}
sync = true;
statuus.remove(s);
}
use of jackiecrazy.wardance.skill.SkillData in project WarDance by Jackiecrazy.
the class Mark method write.
@Override
public CompoundNBT write() {
CompoundNBT to = new CompoundNBT();
if (!this.statuus.isEmpty()) {
ListNBT listnbt = new ListNBT();
for (SkillData effectinstance : this.statuus.values()) {
listnbt.add(effectinstance.write(new CompoundNBT()));
}
to.put("ActiveAfflictions", listnbt);
}
return to;
}
Aggregations