Search in sources :

Example 1 with SkillData

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));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) SkillData(jackiecrazy.wardance.skill.SkillData) CombatDamageSource(jackiecrazy.wardance.api.CombatDamageSource)

Example 2 with SkillData

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;
}
Also used : SkillData(jackiecrazy.wardance.skill.SkillData)

Example 3 with SkillData

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;
}
Also used : SkillData(jackiecrazy.wardance.skill.SkillData)

Example 4 with SkillData

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);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) SkillData(jackiecrazy.wardance.skill.SkillData)

Example 5 with SkillData

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;
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) SkillData(jackiecrazy.wardance.skill.SkillData) CompoundNBT(net.minecraft.nbt.CompoundNBT)

Aggregations

SkillData (jackiecrazy.wardance.skill.SkillData)12 CompoundNBT (net.minecraft.nbt.CompoundNBT)6 ListNBT (net.minecraft.nbt.ListNBT)5 LivingEntity (net.minecraft.entity.LivingEntity)4 Skill (jackiecrazy.wardance.skill.Skill)2 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)2 CombatDamageSource (jackiecrazy.wardance.api.CombatDamageSource)1 SyncSkillPacket (jackiecrazy.wardance.networking.SyncSkillPacket)1 UpdateAfflictionPacket (jackiecrazy.wardance.networking.UpdateAfflictionPacket)1 StringNBT (net.minecraft.nbt.StringNBT)1